Focal Point
load field's value into a variable

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

August 14, 2008, 08:42 PM
JohnB
load field's value into a variable
It's easy to assign the value of a variable to a field. But what about the reverse?

How do you assign the value of a field to a variable without having to do a -READ? If you have a data file and mfd, is there a way to read the file with a table request and then take the value of a field and put it into a variable?

Thank you,

John


WF 7.7.03, Windows 7, HTML, Excel, PDF
August 15, 2008, 12:54 AM
Danny-SRL
John,

Can this do the trick?
  
-* File johnb6.fex
-SET &ECHO=ALL;
FILEDEF JFEX DISK JFEX.FEX
SET HOLDLIST=PRINTONLY
TABLE FILE CAR
PRINT 
COMPUTE I/I1=1 + LAST I; NOPRINT
COMPUTE SET1/A30='-SET &|V' | EDIT(I,'9=''') | COUNTRY || ''';';
ON TABLE SAVE AS JFEX
END 
-RUN
-INCLUDE JFEX



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

August 15, 2008, 09:42 AM
GinnyJakes
A simpler variation would be:

TABLE FILE CAR
PRINT COUNTRY
IF RECORDLIMIT EQ 1
ON TABLE SAVE
END
-RUN
-READ SAVE &COUNTRY.A10.


There are lots of variations on this. You could read all the cars and save &LINES and use it as a loop counter to read all the countries in the SAVE files.

There should be lots of examples of this in forum posts. Try searching on SAVE or AMPER VARIABLE.

Hope this gives you some ideas.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
August 15, 2008, 10:27 AM
Danny-SRL
Ginny,

John said:
quote:

How do you assign the value of a field to a variable without having to do a -READ?

...


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

August 15, 2008, 11:16 AM
GinnyJakes
Sorry I missed that. I was up very late watching Olympics. Doesn't bode well for the rest of the day, does it? Confused


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
August 15, 2008, 01:27 PM
Darin Lee
Daniel - Seems like that is the very long way around just to avoid a -READ, but it DOES answer the question. Smiler

Either way, it's going to take two steps. There isn't a way to do it in a single steps. So

1)create -SETs, hold, and then -INCLUDE (creates multiple variables)
or
2)hold and then -READ (creates multiple values to use with a single variable)


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
August 16, 2008, 02:07 PM
Danny-SRL
Darin,

Yes. It seems a bit of a roundabout way. Nonetheless, it would depend on what you want to achieve. If, for instance you do want multiple variables, I would say that, not having a loop would make the -INCLUDE more efficient.
In any case it is good to know that WF allows for interesting program generation by creating DM commands in a file and then including them, dynamically.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF