As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
Hello, I am creating a hold file like this: ON TABLE HOLD AS BABEMRN_MEAS FORMAT ALPHA
then doing a read statement like this: -READ BABEMRN_MEAS, &BABY_MEAS
Right now there is only one value in the &BABY_MEAS variable, because there is only one value in the BABEMRN_MEAS table. What if there were two values in the BABEMRN_MEAS table and I needed to capture them both?
You would read the Hold file in a loop and put the variable into an indexed Amper variable. e.g. -SET &N=1 ; -REPEAT FRED 2 TIMES -READ HOLD &VAL.&N -SET &N=&N+1; -FRED
Here's an example using the CAR file, reading the hold file and setting variables
TABLE FILE CAR SUM SALES BY COUNTRY ON TABLE HOLD AS HOLD_CAR FORMAT ALPHA END -RUN -SET &V_COUNTRY = ' '; -SET &V_SALES = 0; -TYPE START LOOP -TYPE ------------------------------------------- -REPEAT :LOOP &LINES TIMES -READ HOLD_CAR &V_COUNTRY.A10. &V_SALES.I6. -TYPE V_COUNTRY = &V_COUNTRY --- V_SALES = &V_SALES -:LOOP -TYPE ------------------------------------------- -TYPE END LOOP
Jim
WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005
This is excellent code and it is moving me in the right direction, but I don't think I made my objective clear. Later on in my code I have to put these variables into the header of my PDF file. So, one day, I could have two variables, the next day, three... up to five. So, I kind of need some way to say "if this variable exists then put it in the header..."
How about something like this to put your values into a focexec. In this example I use the CAR file, but you get the idea:
FILEDEF HEADTXT DISK headtxt.fex SET HOLDLIST=PRINTONLY DEFINE FILE CAR HEADLINE/A80 = '"' | COUNTRY | '"'; END TABLE FILE CAR PRINT HEADLINE ON TABLE SAVE AS HEADTXT END -RUN
and then later on -INCLUDE the HEADTXT fex into your report header.
WF 7.1.6 moving to WF 7.7, Solaris 10, HTML,PDF,XL
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003
Hey, This is great information. I just want to know if there is another format I can save my hold file as, instead of alpha, so that I don't have to know the exact number of spaces to read for each field?
You can use the alternate form of the -READ statement where you do not have to identify the length -
TABLE FILE CAR
BY MODEL
ON TABLE SAVE AS MODELS
END
-RUN
-SET &ModelCnt = &LINES;
-SET &N = 1;
-REPEAT :Loop &LINES TIMES;
-READ MODELS, &Model.&N
-SET &N = &N + 1;
-:Loop
-SET &ModelCnt = &N - 1;
-? &Model
The important piece is the comma after the save or hold file name - -READ MODELS, and &ModelCnt will give you the number of amper vars (there are two places to achieve this shown).
TThis message has been edited. Last edited by: Tony A,
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Apologies, you wanted to display all of the variables in a heading -
TABLE FILE CAR
BY COUNTRY
ON TABLE SAVE AS COUNTRYS
END
-RUN
-SET &N = 1;
-REPEAT :Loop1 &LINES TIMES;
-READ COUNTRYS, &Country.&N
-SET &N = &N + 1;
-:Loop1
-SET &CountryCnt = &N - 1;
-? &Country
TABLE FILE GGSALES
BY REGION NOPRINT
IF RECORDLIMIT EQ 1
HEADING
"
-SET &N = 1;
-REPEAT :Loop2 &CountryCnt TIMES;
&Country.&N <0X
-SET &N = &N + 1;
-:Loop2
"
END
Will do this for you using my suggestion above, or
FILEDEF HEADTXT DISK headtxt.fex
SET HOLDLIST=PRINTONLY
DEFINE FILE CAR
HEADLINE/A80 = '"' | COUNTRY | '"';
END
TABLE FILE CAR
BY HEADLINE
ON TABLE SAVE AS HEADTXT
END
-RUN
TABLE FILE GGSALES
BY REGION NOPRINT
IF RECORDLIMIT EQ 1
HEADING
-INCLUDE HEADTXT
END
Using JbMuirs.
T
Edited as I forgot the line continuation syntax for the first sampleThis message has been edited. Last edited by: Tony A,
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
After my edit of the last post, I got to thinking that you could achieve the same, one line header, using JBs suggestion -
FILEDEF HEADTXT DISK headtxt.fex
SET HOLDLIST=PRINTONLY
DEFINE FILE CAR
HEADLINE/A80 = COUNTRY || ', <0X';
END
TABLE FILE CAR
BY HEADLINE
ON TABLE SAVE AS HEADTXT
END
-RUN
TABLE FILE GGSALES
BY REGION NOPRINT
IF RECORDLIMIT EQ 1
HEADING
"
-INCLUDE HEADTXT
"
END
Note that you will receive a FOC227 - "The Focexec Procedure cannot be found" error on running this. The reason is that the fex doesn't exist at the time the dialogue manager (any line begining with a "-") is processed, which is before the TABLE request that produces it. Therefore, in this instance, it is not a problem, per se.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
This is awesome, but still something bugs me about the SET HOLDLIST=PRINTONLY. I've never used that before, so I looked it up, but I cannot tell from the reference manual why it makes a difference in this situation. I tried running Tony's last program without the HOLDLIST parameter and of course the output was the hold file table specs. I'm sure that there is some kind of deal between the HOLDLIST and the -RUN statement that makes the difference. Can anybody explain it to me though? Thanks!
OK, got another question. What if I have two variables in my hold file and I need not only each row to be a different amper variable, but also each column. My code that I attempted to do this with was like this:
If you want to -READ more than one variable per row, you either have to specify the size of the variable (&VAR1.a10.) or read one variable (as per Tony's example) and then separate that one into two via a substring function working with a delimiter between the two pieces.
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
Mark, are there some reasons why you don't want to use the lengths of the columns? There are a lot of good suggestions in here. Here's another method that will work as well:
TABLE FILE CAR PRINT COUNTRY ON TABLE SAVE AS CNTRY END -RUN -SET &TOTLINES = &LINES ;
OK, I think I am almost there, but I've got one last issue. Right now, I've got an amper variable for each BABYMRN... &babymrn1, &babymrn2. Now, I need those to be seperate on the corresponding headers for each page of my report. So, what I have done is say on the footer of every page saying:
FOOTING BOTTOM "BABYMRN: &BABYMRN&TABPAGENO"
Thinking that for the first page, the &BABYMRN1 variable will be in the footer of the first page, &BABYMRN2 will be in the footer of the second page, etc....,
Is this possible? Is there an easier way? Thank you!!!!!
Mark, if you want to have a value on each individual page, then why are you even bothering with the & variables at all? If you have the column in a sort column and then issue
ON SORTCOLUMN PAGE-BREAK
you'll get the data on separate pages.
Using the car file
TABLE FILE CAR HEADING "COUNTRY : SUM RETAIL_COST BY COUNTRY PAGE-BREAK END
I'm really confused as to why you'd bother to go through all this other processing if this is the end state you're working towards.
Ken
Prod - WF 7.6.4 Unix/Solaris - Self-Service, BI Dashboard, MRE Dev - WF 7.6.4 Unix/Solaris - Self-Service, BI Dashboard, MRE Databases: Oracle 10g, SQL Server 2000, DB2.
That's the thing - the table file that I'm printing is different, but needs to have the Baby MRN on each corresponding page. I originally wanted to do a join back to the original data based on three different join fields, but it would be complicated processing with several hold files in order to get the output just right. That's why I thought that amper variables would be easier.
I guess I really mean inefficient, perhaps? I would join back to the original file and then would have to use some kind of recursive join to spread that BABYMRN value over all corresponding records. So after the join, my table would be: MOM,BABYMRN,MEASURE A,,X A,123,Y A,,Z A,,XX Because I would be joining back to the original data based on MOM and MEASURE.
But I need to spread that BABYMRN out so: MOM,BABYMRN,MEASURE A,123,X A,123,Y A,123,Z A,123,XX