I am generating a cursor with field names produced on the fly, depending on
the month that the routine is run.

I want to design a report and display these fields and wondered whether I
could do it via macro substitution, along the lines of

lcVariable = <fieldname>

and then in the report detail band put

&lcVariable

but it failed. I tried making the variable private or public but this had no
effect. Is there a way of doing this?

Sincerely

Stephen

Re: macro substitution in a report by Man-wai

Man-wai
Thu Aug 17 07:34:03 CDT 2006

> I want to design a report and display these fields and wondered whether I
> could do it via macro substitution, along the lines of
>
> lcVariable = <fieldname>
> and then in the report detail band put
> &lcVariable

You could also do this in runtime:

copy the_report.frx to cur_report.frx
copy the_report.frt to cur_report.frt
USE cur_report.frx shared
replace all ... with ...
use in cur_report
report form cur_report preview
delete file cur_report.*

--
.~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06) Linux 2.6.17.8
^ ^ 20:32:01 up 10 days 1:28 0 users load average: 1.00 1.00 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

Re: macro substitution in a report by Jack

Jack
Thu Aug 17 11:14:58 CDT 2006

On Thu, 17 Aug 2006 12:27:24 +0100, "Stephen Ibbs"
<stephen@datadevelopments.co.uk> wrote:

>I am generating a cursor with field names produced on the fly, depending on
>the month that the routine is run.
>
>I want to design a report and display these fields and wondered whether I
>could do it via macro substitution, along the lines of
>
>lcVariable = <fieldname>
>
>and then in the report detail band put
>
>&lcVariable
>
>but it failed. I tried making the variable private or public but this had no
>effect. Is there a way of doing this?
>
>Sincerely
>
>Stephen

You could try EVALUATE(lcVariable) instead of macro substitution.

If you are creating the cursor on the fly, why not just use fixed
field names?


Re: macro substitution in a report by Stephen

Stephen
Thu Aug 17 11:24:05 CDT 2006

Thanks Jack

The reason I am not using fixed field names because I am also giving the
users the option of exporting the data e.g. to Excel and I want them to be
meaningful names like August total, September total etc. The routine starts
from the month they provide, and then generates the next year's projected
totals. I want this displayed in a grid with the provided month as the first
column, and then in a report with the provided month as the first column.

I have got the grid working now, so it is only the report. If the provided
month is AUGUST then the report layout either needs to change by hacking the
frx, or I was hoping to do it via macro substitution but it looks like the
FRX is the way to go.

Thanks

Stephen


"Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
news:hc59e2t9qia66hi22amitru0mstqhogi9e@4ax.com...
> On Thu, 17 Aug 2006 12:27:24 +0100, "Stephen Ibbs"
> <stephen@datadevelopments.co.uk> wrote:
>
>>I am generating a cursor with field names produced on the fly, depending
>>on
>>the month that the routine is run.
>>
>>I want to design a report and display these fields and wondered whether I
>>could do it via macro substitution, along the lines of
>>
>>lcVariable = <fieldname>
>>
>>and then in the report detail band put
>>
>>&lcVariable
>>
>>but it failed. I tried making the variable private or public but this had
>>no
>>effect. Is there a way of doing this?
>>
>>Sincerely
>>
>>Stephen
>
> You could try EVALUATE(lcVariable) instead of macro substitution.
>
> If you are creating the cursor on the fly, why not just use fixed
> field names?
>



Re: macro substitution in a report by Jack

Jack
Thu Aug 17 16:13:53 CDT 2006

Did you try EVALUATE()?

On Thu, 17 Aug 2006 17:24:05 +0100, "Stephen Ibbs"
<stephen@ibbs.org.uk> wrote:

>Thanks Jack
>
>The reason I am not using fixed field names because I am also giving the
>users the option of exporting the data e.g. to Excel and I want them to be
>meaningful names like August total, September total etc. The routine starts
>from the month they provide, and then generates the next year's projected
>totals. I want this displayed in a grid with the provided month as the first
>column, and then in a report with the provided month as the first column.
>
>I have got the grid working now, so it is only the report. If the provided
>month is AUGUST then the report layout either needs to change by hacking the
>frx, or I was hoping to do it via macro substitution but it looks like the
>FRX is the way to go.
>
>Thanks
>
>Stephen
>
>
>"Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
>news:hc59e2t9qia66hi22amitru0mstqhogi9e@4ax.com...
>> On Thu, 17 Aug 2006 12:27:24 +0100, "Stephen Ibbs"
>> <stephen@datadevelopments.co.uk> wrote:
>>
>>>I am generating a cursor with field names produced on the fly, depending
>>>on
>>>the month that the routine is run.
>>>
>>>I want to design a report and display these fields and wondered whether I
>>>could do it via macro substitution, along the lines of
>>>
>>>lcVariable = <fieldname>
>>>
>>>and then in the report detail band put
>>>
>>>&lcVariable
>>>
>>>but it failed. I tried making the variable private or public but this had
>>>no
>>>effect. Is there a way of doing this?
>>>
>>>Sincerely
>>>
>>>Stephen
>>
>> You could try EVALUATE(lcVariable) instead of macro substitution.
>>
>> If you are creating the cursor on the fly, why not just use fixed
>> field names?
>>
>

RE: macro substitution in a report by Yan

Yan
Thu Aug 17 20:15:01 CDT 2006

Hi Stephen!
You could try opening the FRX report file and update the Expr field. Records
having ObjType = 8 are the fields of the REPORT FILE. You may replace the
Expr field with the appropriate fields that you assigned to your table/
cursor.

But there is also another approach for this scenario. In my case, I would
create the report by using one of my tables. Then in the BeforeOpenTables of
the DataEnvironment I would change the alias of the table I used in the
creation of the report then I would copy the generated cursor to another
cursor but having the same alias and fields as the table I used during the
creation of the report. (Copying the cursor through the use of SELECT - SQL
command with the option AS for the field names). The field names should match
the table used during the creation of the report so that you wont need to do
any other thing cause the report will still find the appropriate
<alias.field> assigned in the report. As for the exporting the cursor to an
Excel file I would just use the SELECT - SQL command again with the option AS
for the field names then create the Excel file.

Hope this helps!


Ryan Paradela





"Stephen Ibbs" wrote:

> I am generating a cursor with field names produced on the fly, depending on
> the month that the routine is run.
>
> I want to design a report and display these fields and wondered whether I
> could do it via macro substitution, along the lines of
>
> lcVariable = <fieldname>
>
> and then in the report detail band put
>
> &lcVariable
>
> but it failed. I tried making the variable private or public but this had no
> effect. Is there a way of doing this?
>
> Sincerely
>
> Stephen
>
>
>

Re: macro substitution in a report by Imaginecorp

Imaginecorp
Sat Aug 19 19:38:28 CDT 2006

Strange; we do it all the time but using Report variables which are assigned
values from Public Variables declared in the calling program
i.e.
Calling program:
Public p1,p2...
Report Variables
r1 = p1
r2 = p2
........
After the report executes,
Release p1,p2.. extended

Mohammed

"Stephen Ibbs" <stephen@datadevelopments.co.uk> wrote in message
news:uW97kAfwGHA.2232@TK2MSFTNGP05.phx.gbl...
>I am generating a cursor with field names produced on the fly, depending on
>the month that the routine is run.
>
> I want to design a report and display these fields and wondered whether I
> could do it via macro substitution, along the lines of
>
> lcVariable = <fieldname>
>
> and then in the report detail band put
>
> &lcVariable
>
> but it failed. I tried making the variable private or public but this had
> no effect. Is there a way of doing this?
>
> Sincerely
>
> Stephen
>
>



Re: macro substitution in a report by Stephen

Stephen
Sun Aug 20 06:09:27 CDT 2006

Many thanks Mohammed and Jack

I had thought about report variables and also Evaluate() but I still can't
see how to get the content of the field displayed on the report. I can pass
the name of the Field as a public variable but it is persuading the report
to print the contents of the field that is the problem.

Stephen

"Imaginecorp" <imaginecorp@msn.com> wrote in message
news:O4DQwD$wGHA.4160@TK2MSFTNGP06.phx.gbl...
> Strange; we do it all the time but using Report variables which are
> assigned values from Public Variables declared in the calling program
> i.e.
> Calling program:
> Public p1,p2...
> Report Variables
> r1 = p1
> r2 = p2
> ........
> After the report executes,
> Release p1,p2.. extended
>
> Mohammed
>
> "Stephen Ibbs" <stephen@datadevelopments.co.uk> wrote in message
> news:uW97kAfwGHA.2232@TK2MSFTNGP05.phx.gbl...
>>I am generating a cursor with field names produced on the fly, depending
>>on the month that the routine is run.
>>
>> I want to design a report and display these fields and wondered whether I
>> could do it via macro substitution, along the lines of
>>
>> lcVariable = <fieldname>
>>
>> and then in the report detail band put
>>
>> &lcVariable
>>
>> but it failed. I tried making the variable private or public but this had
>> no effect. Is there a way of doing this?
>>
>> Sincerely
>>
>> Stephen
>>
>>
>
>



Re: macro substitution in a report by Jack

Jack
Sun Aug 20 12:11:15 CDT 2006

If the name of the field is in the variable cFld, then put
EVALUATE(cFld) in the expression of the report control.

On Sun, 20 Aug 2006 12:09:27 +0100, "Stephen Ibbs"
<stephen@ibbs.org.uk> wrote:

>Many thanks Mohammed and Jack
>
>I had thought about report variables and also Evaluate() but I still can't
>see how to get the content of the field displayed on the report. I can pass
>the name of the Field as a public variable but it is persuading the report
>to print the contents of the field that is the problem.
>
>Stephen
>
>"Imaginecorp" <imaginecorp@msn.com> wrote in message
>news:O4DQwD$wGHA.4160@TK2MSFTNGP06.phx.gbl...
>> Strange; we do it all the time but using Report variables which are
>> assigned values from Public Variables declared in the calling program
>> i.e.
>> Calling program:
>> Public p1,p2...
>> Report Variables
>> r1 = p1
>> r2 = p2
>> ........
>> After the report executes,
>> Release p1,p2.. extended
>>
>> Mohammed
>>
>> "Stephen Ibbs" <stephen@datadevelopments.co.uk> wrote in message
>> news:uW97kAfwGHA.2232@TK2MSFTNGP05.phx.gbl...
>>>I am generating a cursor with field names produced on the fly, depending
>>>on the month that the routine is run.
>>>
>>> I want to design a report and display these fields and wondered whether I
>>> could do it via macro substitution, along the lines of
>>>
>>> lcVariable = <fieldname>
>>>
>>> and then in the report detail band put
>>>
>>> &lcVariable
>>>
>>> but it failed. I tried making the variable private or public but this had
>>> no effect. Is there a way of doing this?
>>>
>>> Sincerely
>>>
>>> Stephen
>>>
>>>
>>
>>
>

Re: macro substitution in a report by Stephen

Stephen
Mon Aug 21 15:23:17 CDT 2006

Many thanks Jack - worked perfectly.

Stephen

"Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
news:dp5he2dal2dno8tt5dump7mcd8v1h4ob3h@4ax.com...
> If the name of the field is in the variable cFld, then put
> EVALUATE(cFld) in the expression of the report control.
>
> On Sun, 20 Aug 2006 12:09:27 +0100, "Stephen Ibbs"
> <stephen@ibbs.org.uk> wrote:
>
>>Many thanks Mohammed and Jack
>>
>>I had thought about report variables and also Evaluate() but I still
>>can't
>>see how to get the content of the field displayed on the report. I can
>>pass
>>the name of the Field as a public variable but it is persuading the report
>>to print the contents of the field that is the problem.
>>
>>Stephen
>>
>>"Imaginecorp" <imaginecorp@msn.com> wrote in message
>>news:O4DQwD$wGHA.4160@TK2MSFTNGP06.phx.gbl...
>>> Strange; we do it all the time but using Report variables which are
>>> assigned values from Public Variables declared in the calling program
>>> i.e.
>>> Calling program:
>>> Public p1,p2...
>>> Report Variables
>>> r1 = p1
>>> r2 = p2
>>> ........
>>> After the report executes,
>>> Release p1,p2.. extended
>>>
>>> Mohammed
>>>
>>> "Stephen Ibbs" <stephen@datadevelopments.co.uk> wrote in message
>>> news:uW97kAfwGHA.2232@TK2MSFTNGP05.phx.gbl...
>>>>I am generating a cursor with field names produced on the fly, depending
>>>>on the month that the routine is run.
>>>>
>>>> I want to design a report and display these fields and wondered whether
>>>> I
>>>> could do it via macro substitution, along the lines of
>>>>
>>>> lcVariable = <fieldname>
>>>>
>>>> and then in the report detail band put
>>>>
>>>> &lcVariable
>>>>
>>>> but it failed. I tried making the variable private or public but this
>>>> had
>>>> no effect. Is there a way of doing this?
>>>>
>>>> Sincerely
>>>>
>>>> Stephen
>>>>
>>>>
>>>
>>>
>>