Forum OpenACS Q&A: error to note-add.tcl - Newbie question

following "Using Templates in OpenACS 5.0.0a4" at https://openacs.org/doc/openacs-HEAD/templates.html

I get the error message:

Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")

ERROR:  Attribute 'first_names' not found

SQL:
    select first_names || ' ' || last_name as user_name
    from users
    where forum_id = '425'
[MORE]

is the syntax "field || ' ' || field" correct ? or is it that first_names is not to be found in table users?

thanks for any help.
Yves.

Collapse
Posted by Claudio Pasolini on
Yves,

user information is actually spread on several tables, i.e. parties, persons and users and the column first_names is on persons table, not on users.

You could use the cc_users view wich joins all the necessary tables or simply check the columns in the various tables using the psql command \d table_name (if you are using PostgreSQL) or the sqlplus command descr table_name (if Oracle).

Collapse
Posted by Yves Goldberg on
Hi Claudio,
thank you very much for your help. I've learned to use psql \d wich will help me a lot!!

I couldn't make the example work though. If I use table users there's no first_name ... so I've used cc_users as you proposed but then forum_id is not to be found and I wonder why forum_id has something to do here.

anyway is it possible to documentation is simply not up to date anymore?

If this is the case; where do I report this?
Do I add it to bugtracker?

thanks again.

Collapse
Posted by Claudio Pasolini on
Yves,

I had not noticed in your query the use of forum_id. This column has nothing to do with the users, persons and parties tables.

If your objective was to find the users posting messages in a specific forum you should use the forum_messages table, but I suggest that you study the data model first.

Collapse
Posted by Yves Goldberg on
Claudio,

I'm only trying to reproduce the example in the documentation with the purpose to start learning how to use oacs.
One of the first page recommended to read is "Using Templates in OpenACS 5.0blabla ( https://openacs.org/doc/openacs-HEAD/templates.html )

It seems there's a mistake in the notes and that the example as it is doesn't work.

I would like to report this so it get notice and a chance to be corrected someday.

I'll add my first entry to bug tracker and we'll see.
thanks for your feedback.