Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How Can I do this, Set a variable based on value in table

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How Can I do this, Set a variable based on value in table
 Login/Join
 
Master
posted
I am confusing myself but I think I should be able to do this.

I want to evaluate a table and see what the LATEST month is in the table.

I want to set a variable equal that value.

I want to test the variable to controll which fex to run.

Example, if the latest period in the financials table is 201809 then I want to run fex1 otherwise fex2.

I have done similar things by prompting the user for, say a report type, and then evaluating what they chose but can I set a variable to the max period in my financials table?

I hope this makes sense.

Perhaps someone can share code using CAR to show me how?

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


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Virtuoso
posted Hide Post
Run the first request to find the date you want and HOLD then -READFILE the field from the HOLD file.

Here's an example I found by another user using search:

  
TABLE FILE CAR
PRINT
COUNTRY
CAR
MODEL
BODYTYPE
SEATS
DEALER_COST
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS HLD_VARS
END
? HOLD HLD_VARS
-RUN
-READFILE HLD_VARS
-TYPE --------------------------------
-TYPE COUNTRY --------- &COUNTRY
-TYPE CAR ------------- &CAR
-TYPE MODEL ----------- &MODEL
-TYPE BODYTYPE -------- &BODYTYPE
-TYPE SEATS ----------- &SEATS
-TYPE DEALER_COST ----- &DEALER_COST

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


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Master
posted Hide Post
yes, I do not know how to do that? I know I need a variable to house it.


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Virtuoso
posted Hide Post
I just posted an example above. Notice the &variable name is assigned using the hold file's column name.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
Hello,

Here is another similar solution that I use to accomplish this:

 
TABLE FILE CAR
SUM
	DEALER_COST
WHERE COUNTRY EQ 'America';
ON TABLE HOLD AS 'HOLD' FORMAT ALPHA
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN
-READ HOLD &DEALER_COST.A8.
-TYPE &DEALER_COST
 


BabakNYC's code looks a lot more efficient for multiple variables. I'm gonna use that moving forward!


WebFOCUS 8204
 
Posts: 152 | Registered: July 10, 2018Report This Post
Master
posted Hide Post
well this works EXCEPT it prompts for a value for &PD...I can not have this prompting though...thoughts..

SET ASNAMES = ON
TABLE FILE TBLMSTR_YTDEMPLOYEEFTES
BY LOWEST TBLMSTR_YTDEMPLOYEEFTES.TBLMSTR_YTDEMPLOYEEFTES.ASOFPERIOD AS PD
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS HOLDPD FORMAT ALPHA
END
-RUN
-READFILE HOLDPD
-TYPE LATESTFTEPD IS : &PD


I believe I should be able to evaluate LATESTPD...but I can not have the user prompted...


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Platinum Member
posted Hide Post
Hey Robert,

I believe you need to have the value you want to read as either a SUM or a PRINT in order for it to be read.


WebFOCUS 8204
 
Posts: 152 | Registered: July 10, 2018Report This Post
Virtuoso
posted Hide Post
Robert

Use

-DEFAULTH &PD='';

at the beginning of the fex.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Master
posted Hide Post
it is reading my table and printing that latest Period when the type statement is executed. It works. It is also prompting for &PD...which is irrelevent since whatever I enter at the prompt is replaced with the data from the hold file created. How do I get rid of the prompt? It makes no sense to prompt the user.....


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Virtuoso
posted Hide Post
SET ASNAMES = ON
-DEFAULTH &PD = ''
TABLE FILE TBLMSTR_YTDEMPLOYEEFTES
BY LOWEST TBLMSTR_YTDEMPLOYEEFTES.TBLMSTR_YTDEMPLOYEEFTES.ASOFPERIOD AS 'PD'
ON TABLE HOLD AS HOLDPD
END
-RUN
-READFILE HOLDPD
-TYPE LATESTFTEPD IS : &PD


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Master
posted Hide Post
THANKS!


I seem to be able to evaluate &PD now...no prompts!


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Expert
posted Hide Post
Robert,

What happens with parameter prompting is the Fex is scanned to all &vars, and if there is no -DEFAULT(S|H) or -SET (before the first use) then the prompt will happen.

This can be turned off in the Administration Console.

As an extra note, two suggestions were given to you to stop the prompt.

-DEFAULTH, this provides a default value of the variable.
-SET, this sets the variable to a value.

An extra option is to use the -SET with no value.

e.g.
-SET &PD =;

This clears the variable, and also stops the prompt.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Master
posted Hide Post
thank you!


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How Can I do this, Set a variable based on value in table

Copyright © 1996-2020 Information Builders