Focal Point
[SOLVED] Variables

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

April 17, 2018, 02:55 PM
Alma Guardiola
[SOLVED] Variables
Is there a way a field value can be moved into a variable? I'm trying to move a counter field to a variable so that I can use the -IF command to create a loop depending on the counter.

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8
Windows, All Outputs
April 17, 2018, 02:57 PM
BabakNYC
You'll have to use HOLD FORMAT ALPHA to write it to disk and use -READ to read it into an &VARIABLE.


WebFOCUS 8206, Unix, Windows
April 17, 2018, 03:13 PM
Francis Mariani
TABLE FILE CAR
COUNT MODEL AS MODEL_COUNT
ON TABLE HOLD AS H001
ON TABLE SET ASNAMES ON
END
-RUN

-READFILE H001

-TYPE MODEL COUNT: &MODEL_COUNT



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 17, 2018, 03:14 PM
Alma Guardiola
I tried doing that but it keeps the last counter number. My situation is I have hold file and each record has a different counter. I want to move this counter for each record into a variable. Is this possible?

I am trying to produce a list of student who have holds. Some students have 1 hold, while others have more than 1. How can I have the report list only the number of holds each student has? The output needs to be in XML format.


WebFOCUS 8
Windows, All Outputs
April 17, 2018, 03:24 PM
BabakNYC
I'm at a loss how these variables will then be used. Could you give us a report spec? Maybe there's a different way of doing this that won't involve variables.


WebFOCUS 8206, Unix, Windows
April 17, 2018, 03:28 PM
Danny-SRL
Alma,
Try this:
  
TABLE FILE CAR
COUNT MODEL AS M
BY COUNTRY
ON TABLE HOLD AS H001
ON TABLE SET ASNAMES ON
END
-RUN
-SET &C=&LINES;
-REPEAT #GET FOR &I FROM 1 TO &C;
-READFILE H001
-SET &M.&I=&M;
-#GET

This gives you variables &M1, &M2 etc. containing the counts of models per country


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

April 17, 2018, 05:00 PM
Waz
Depending on what you are doing, another option would be to hold the counters and then use a DECODE to pull the wanted number.


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!

April 17, 2018, 05:41 PM
Alma Guardiola
Thank you for your suggestions. Danny-SRL, it worked! Thank you!


WebFOCUS 8
Windows, All Outputs