TOPIC: Next noob question
Next noob question 3 Years, 6 Months ago
OK, now I'm trying to learn to write a report.

I've got a situation where my file responds nicely to a default browse request:

(Browse 'my_file')

but responds to this:

Params(#(Query Query: 'my_file'))


unknown method: string.Variable?

I have a feeling I'm way off on this one; can someone point me in the right direction?

Thanks --

-- Fred Goldrich
Re:Next noob question 3 Years, 6 Months ago
That works from the WorkSpace (at least with 'tables' instead of 'my_file')

But if you want to put it in a library then it has to be a constant, e.g.

#(Params #(Query 'tables'))

(the first argument defaults to the query)

and then run it from the WorkSpace with something like:


(assuming you called the library record 'My_Report')

You might want to run through the Getting Started section of the Users Manual if you haven't already - it has an example exactly like this.
Re:Next noob question 3 Years, 6 Months ago
Andrew --

Thanks for the response.

I'm sorry, I should have been clearer: Yes, it does work with 'tables' instead of 'my_file', and it works with others of my files too.

That's why I'm wondering why it doesn't work with this one. Apparently it doesn't like one of my string fields -- at least that's what I conclude from the string.Variable? complaint -- but whatever is wrong with the field, that doesn't stop it from executing the browse properly.

BTW, the field's name is pg_value, in case that's a problem.

Thanks --

-- Fred
Re:Next noob question 3 Years, 6 Months ago
Do you have a Field_ definition for that field? It sounds like the Format: for that field is not correct.
Re:Next noob question 3 Years, 6 Months ago
Yes, here is the full entry from SchemaView:

Field_pg_value /* PG_lib class : Field_string */
Field_string /* stdlib class */

Prompt: Value
Control: #("Field", width: 20)
Format: #("Text", width: 20)
Re:Next noob question 3 Years, 6 Months ago
The problem is that the 'pg' prefix in the field 'pg_value' confuses RowFormat (specifically it confuses the _report.Construct(arg) statement inside New method of RowFormat).

"pg" is a special format used to start a new page in a report, as you can see in the "User's Manual -> Reports -> Formats" page, but it is not the only. They are:

"pg" start a new page
"pg0" start a new page and reset the page number (the next page will be 1)
"pge" start a new even numbered page
"pgo" start a new odd numbered page

In the implementation of Report.Construct() method in stdlib there is a check a little lazy on these special items:

if (item =~ "^pg")

I think it should be something like:

if (item =~ "^pg[0|e|o]?$")

In this way your code will work well. The only restriction is that you cannot use 'pg', 'pg0', 'pge' or 'pgo' as your field names, but at least with this mod you can use them as prefixes of your field names.

I hope this is helpful. ;)
Re:Next noob question 3 Years, 6 Months ago
Mauro --

It is helpful, thanks very much.

In my own attempts to diagnose the problem, I checked Language/Names/Keywords to see if I was treading upon some reserved namespace. Do you know, is there somewhere else I should be looking to uncover such conflicts?

Unfortunately, I've written a library called "PG", and many of the variable names begin with "pg_". I guess I've got some renaming to do!

Thanks again --

-- Fred
Re:Next noob question 3 Years, 6 Months ago
I think that with the above mod in the Report.Construct code, you shouldn't have to rename nothing anymore, unless you have named some database fields as "pg", "pg0", "pge" or "pgo". The variables with "pg_" and the "PG" library name shouldn't be a problem. Anyway, it's easy to do some tests for this. ;)

Post edited by: Mauro, at: 2007/01/31 17:11
Re:Next noob question 3 Years, 6 Months ago
Mauro --

Yes, I'm sure you're right, and I appreciate your telling me about these four strings that can't be used as field names.

But I wonder, are there others, and is there a practical way for me to identify them in order to avoid similar problems in the future?

Thanks --

-- Fred
Re:Next noob question 3 Years, 6 Months ago
Hi Fred. I'm not 100% sure, but I think that those are the only strings that you shouldn't use for fields of your tables.

Sorry, but I think there is not a practical way to identify all the problems aside from everyday testing. :P