Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] storing Totals or Values as &var
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] storing Totals or Values as &var
 Login/Join
 
Gold member
posted
Not sure about the best way to describe this, but;
End goal: find the percentage Revenue for each Market of the total revenue for the company; 100*(Market Revenue)/(Company Revenue)

I have several HOLD files going down to, and joined at the Market Grain.
I have a separate component finding Revenue at the Company level. I can't display the Market Grained Key without the revenue being broken down by market (I think this is a cube oddity). Without the Key I can't join it to the Market Grain holds.

So is there any way I can store Company Revenue in an &var? Be it a field, from Total, or in DM? other work-arounds?


Thanks!

This message has been edited. Last edited by: Nicholas Spyrison,


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
With something similar to this you can extract the company revenue
TABLE FILE CAR
SUM DEALER_COST AS 'REVENUE'
ON TABLE HOLD AS HLD FORMAT BINARY
END
-RUN
-READFILE HLD
-RUN
-TYPE REVENUE: &REVENUE

Perform on your own Revenue at the Company level file.


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2228 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
TABLE FILE CAR
SUM DEALER_COST AS 'REVENUE'
ON TABLE HOLD AS HLD FORMAT BINARY
END
-RUN
-READFILE HLD
-RUN
-TYPE REVENUE: &REVENUE


But then it just parameter prompts for &REVENUE
shouldn't we have to -SET &REVENUE?

maybe something like the follwoing?

-RUN
-READFILE HLD
-RUN
-SET &REVENUE = <REVENUE;
-TYPE REVENUE: &REVENUE 


or is there something I am missing?
I am using an alpha hold file.


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Add a -DEFAULTH for &REVENUE, this will stop the prompting


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6132 | Location: 33.8688° S, 151.2093° E | Registered: October 31, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
Wouldn't that defeat the point? I am trying to store &REVENUE dynamically, not default it to a value.


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
My assumption is that the fex exists in MRE and when the code is executed, it is scanned for & variables.
If there is no -SET or -DEFAULT(S|H) before the variable it will be prompted.

Adding the -DEFAULTH before(Actually, probably anywhere) the -READFILE will fix this.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6132 | Location: 33.8688° S, 151.2093° E | Registered: October 31, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
I feel like my knowledge is lacking...

Is the -READFILE HLD just going to push <|var into &var then?

I'll try mocking something simpler up in CAR tomorrow. My fex is getting too busy.


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Wait till you have a fex that is over 13k lines...
Eeker


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6132 | Location: 33.8688° S, 151.2093° E | Registered: October 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
Nicholas,

A -DEFAULT(H) will provide a value for the variable if it is not -SET within your process.

A -READ, -SET or -READFILE will override any -DEFAULT that you have previous applied.

As has been mentioned a few times on the Forum recently, -DEFAULTH will be "ignored" by parameter prompting.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5617 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Gold member
posted Hide Post
Try this. You need to read in the var name.

TABLE FILE JACK1
WHERE LISTIT EQ &HOW_MANY;
WRITE CUM_TA_SHR
ON TABLE HOLD AS 'JEFFX' FORMAT ALPHA
END

-RUN
-READ JEFFX &POT.A6.
-RUN


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 75 | Registered: December 23, 2013Reply With QuoteReport This Post
Virtuoso
posted Hide Post
J.L., you method is also good, but you have to be aware of the field format.

Using READFILE all hold field become a variable, you don't mind the format and the variable has the field name as its &var name.

Both method is good. With READFILE you also don't mind about order of fields when you reference them and you can have 4 fields in the hold file but only reference the first and third one, per example. With READ it's important to READ all the &var in the same order/format as they have been hold.


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2228 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
Wait till you have a fex that is over 13k lines...


App studio struggles (or crashes) switching between components of a 250 line, 12 component fex with our set up. How does everyone else manage? tweaking tomcat sever allocation?


I digress...

I have the following working. Note that SET ASNAMES=ON is important here. I will relay this attempt back to my original fex.

SET ASNAMES = ON
TABLE FILE IBISAMP/CAR
SUM
     DEALER_COST AS 'REVENUE'
ON TABLE NOTOTAL
ON TABLE HOLD AS HLD FORMAT BINARY
END
-RUN
-DEFAULTH &REVENUE = 0
-READFILE HLD
-RUN
-TYPE REVENUE: &REVENUE


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Reply With QuoteReport This Post
Gold member
posted Hide Post
OK have it working as expected. Thanks everyone!


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Reply With QuoteReport This Post
Guru
posted Hide Post
I am sure Waz uses a 13k lines fex to do a complex ETL with a lot of MATCHES, JOINS, DEFINES, MODIFYs and etc.

He also should use any text editor to edit those 13k fex under approot. Am i right?


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
In this case yes all done in a text editor, GUI could not handle the code. The code was in the APP path, but this fex (Actually group of fexes) produced statements and I would confidently state that is may be the most complex fex ever done. Certainly in the top 10.

[ Waits for head swelling to subside ]


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6132 | Location: 33.8688° S, 151.2093° E | Registered: October 31, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Ok so

quote:
A -DEFAULT(H) will provide a value for the variable if it is not -SET within your process.

A -READ, -SET or -READFILE will override any -DEFAULT that you have previous applied.

As has been mentioned a few times on the Forum recently, -DEFAULTH will be "ignored" by parameter prompting.


Given this; if I have < -DEFAULTH &FM=' ' > then the variable &FM has some value, however, if I have < -DEFAULTH &WFFMT = 'HTML' > then my variable &WFFMT contains 'HTML'. In either case I won't be prompted for the values of these variable; is that right?

I know this is such a newbie question, but I'm getting there. slowly

Also

-READFILE RPTPERIOD tells me that the fields in RPTPERIOD can be used as variables in any order as long as they are in the same format; is that correct?

Thanks for any clarification you can offer!

Pondog


WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 118 | Location: Birmingham, Al | Registered: July 23, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
quote:
Given this; if I have < -DEFAULTH &FM=' ' > then the variable &FM has some value, however, if I have < -DEFAULTH &WFFMT = 'HTML' > then my variable &WFFMT contains 'HTML'. In either case I won't be prompted for the values of these variable; is that right?

Correct. As long as &FM and &WFFMT don't receive any other value as input parameter from another fex or HTML page they will keep the DEFAULTH value and you won't be prompted to provide values.

quote:
Also-READFILE RPTPERIOD tells me that the fields in RPTPERIOD can be used as variables in any order as long as they are in the same format; is that correct?

Correct. But if there are 4 fields in RPTPERIOD, they don't need to be all in same format. You can have 3 alphanumeric and 1 numeric field. READFILE will assign the proper format to each as they are in the TABLE FILE.


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2228 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Outstanding! Thanks a bunch, MartinY


WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 118 | Location: Birmingham, Al | Registered: July 23, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] storing Totals or Values as &var

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.