Focal Point
[SOLVED] Use a variable value in displaying name of the field with help of ASNAMES

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3667030016

September 21, 2011, 10:02 AM
arsagg
[SOLVED] Use a variable value in displaying name of the field with help of ASNAMES
Hi All,

I am using a variable, say:
PREV.MED/A14 = MED|MONTH.PR|PREV.YR;


The above field PREV.MED has some value say, MEDAUG10.

When I am calculating another field, say:
PREV.MED.TOT/I5 = 88888;

Now, When I am writing the report:
Write
PREV.MED.TOT AS PREV.MED
END

So I am expecting:
MEDAUG10
--------
88888

Please advise if this can be implemented.

This message has been edited. Last edited by: Kerry,


FOCUS 7.6.11
Windows, Excel, LOTUS, ALPHA
September 21, 2011, 10:42 AM
HÃ¥kan
What about an amper variable?

-SET &asname = '88888';


PREV.MED.TOT AS &asname


WebFOCUS DS 8.0.06/08 DS/AS
WebFOCUS RS 8.0.08 (Linux/IBM i)
WebFOCUS Client 8.0.06 (Linux)
September 21, 2011, 11:01 AM
arsagg
Hi Lidholm,

I am using it, since I have a varibale in which I am storing a value, the code mention by you is picking the text of the variable.

You see, the variable is dynamic and suppose to change every month. So I need to have that a dynamic value to it.

Let me know if I have put this clearly.

Thanks


FOCUS 7.6.11
Windows, Excel, LOTUS, ALPHA
September 21, 2011, 11:21 AM
Severus.snape
Hi,

You can first read the values into a amper variable and use that as Lidholm suggested.
Something like

  
TABLE FILE TABLENAME
PRINT
COMPUTE PREV.MED/A14 = MED|MONTH.PR|PREV.YR; 
ON TABLE SAVE AS FIL1
END
-RUN
-READ FIL1, &COLNAME
TABLE FILE TABLENAME
PRINT
COMPUTE PREV.MED.TOT AS &COLNAME
END




Thanks
Sashanka


WF 7.7.03/Windows/HTML,PDF,EXL
POC/local Dev Studio 7.7.03 & 7.6.11
September 21, 2011, 03:08 PM
arsagg
quote:
Sashanka

Hi Sashanka,

Thank you for your reply. Your thought worked with a slight addition to it.

I followed:
Before saving the SAVE file I used -SET &PREV = ' ';

Then I stored it in a SAVE file.
After this:
-RUN
-READ FIL1 &PREV
TABLE FILE MYHOLD
WRITE PREV.MED.TOT AS &PREV
BY FIELD1
ON TABLE HOLD AS HOLDDONE
END

It worked smoothly.

Thank you Lidholm and Sashanka.

Note: peroid was not accepting:
I have changed -SET &PREV.MED to -SET &PMED to get the desired results.


FOCUS 7.6.11
Windows, Excel, LOTUS, ALPHA
September 21, 2011, 05:30 PM
Waz
I would strongly suggest that you do not use a period as a name part separator, as this is used by WebFOCUS to separate Masters and Segmetns and file names, as well as functions like MAX, MIN, FST, LST and TOT.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!