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] Setting a Variable based on Hold File Column Value

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Setting a Variable based on Hold File Column Value
 Login/Join
 
Gold member
posted
I need to create a computation that will divide X by the total days in current year through the end of the current month. So if the report ran in Feb of this year it would have used a value of 59 for this computation. I wanted to approach this by creating a hold file in my procedure that returned the value for days of year through current month. So for example my hold file names would have one field named with a value of 59 if run in February. I then was going to set a variable such that

-SET &&TESTDATE = 'DATEHOLD.DAYOFYEAR';

My expectation is that this would set &&TESTDATE = 59 and then in my final report I could just say WHERE DAYOFYEAR=&&TESTDATE to provide me the correct value for my computation. I am getting errors with my SET statement and figure I am doing something incorrect with the syntax. Does this approach make sense and/or is there a better way I should approach this?

Thanks,
Bob

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


WebFOCUS 7.6.8
WebFOCUS Client and Server running on RedHat Linux, Developer Studio on Windows XP
All output formats
 
Posts: 52 | Registered: May 13, 2009Report This Post
Expert
posted Hide Post
close.
FIrst, you probably want to be using single &variables, not double.
When you figure out the days, i'm assuming you are doing some work and creating a hold file called DATEHOLD which contains a field called DAYOFYEAR? is that right?
..
TABLE FILE whatever
SUM COMPUTE DAYOFYEAR/I3= whatever is your calc;
ON TABLE SAVE AS DATEHOLD
END
-RUN
-READ DATEHOLD &DAYOFYEAR.A3
TABLE FILE whateverelse
IF DAYOFYEAR EQ &DAYOFYEAR
SUM whatever
END
..
Having shown you how to read back a value from a SAVE file (or HOLD FORMAT ALPHA) into an &var, there is a way to directly figure out the number of days since the beginning of the year using a function on the todays date &YYMD.
I'll get back to you in a minute..
or another one of us will zip in and address that...




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Why bother with a hold file? Just use a -SET to calculate another &variable containing that value and then use that &var in your procedure. Steps:

1. Get current date
2. Use edit to create 01/01/current year (DATEMOV also works, but requires more steps)
3. Use DATECVT and DATEDIF functions to calculate number of days elapsed. (you must use DATECVT in dialogue manager for date functions) MAKE SURE YOU ADD ONE (+1) to this to get the current day of the year.

If you create a hold file, you'll just have to -READ the value back into a parameter, so forget about creating a file and stick with the parameter.


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
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
-SET &&TESTDATE = 'DATEHOLD.DAYOFYEAR';
is invalid syntax - you can't set a Dialogue Manager variable to a data-column value.

You can read the HOLD file with the Dialogue Manager command -READ:

-READ DATEHOLD &DUMMY1.A50. &TESTDATE.A8.
where DUMMY1 is the length of all the data before the date you want to read.

Or, you can use DATE functions to determine the number of days for the date at the end of the month:

-SET &DT_BOY = EDIT(&YYMD,'99990101');

-SET &DT_EOM = DATECVT((DATEMOV((DATECVT(&YYMD,'I8YYMD','YYMD')),'EOM')),'YYMD','I8YYMD');

-SET &NBR_DAYS = DATEDIF(DATECVT(&DT_BOY,'I8YYMD','YYMD'), DATECVT(&DT_EOM,'I8YYMD','YYMD'), 'D') + 1;

-TYPE &NBR_DAYS

This message has been edited. Last edited by: Francis Mariani,


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Thanks for the great feedback. I tested a few of these options and they appear to give me what I am looking for. Now off to study more about Dialog Manager. This was something we didn't review during our initial introduction to WebFOCUS but seems incredibly powerful if you understand the appropriate syntax.


WebFOCUS 7.6.8
WebFOCUS Client and Server running on RedHat Linux, Developer Studio on Windows XP
All output formats
 
Posts: 52 | Registered: May 13, 2009Report 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] Setting a Variable based on Hold File Column Value

Copyright © 1996-2020 Information Builders