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]Set Default Variable

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Set Default Variable
 Login/Join
 
Gold member
posted
I would like to set 2 default variables. I currently have them hard coded as seen in the data below, I would like to have STARTDATE set to today and ENDDATE set to 7 days ago. How would I go about this. Thank you.

 -DEFAULT &STARTDATE = '2014/10/20';
-DEFAULT &ENDDATE = '2014/10/27';
-*-DEFAULT &DIVISION = '1D' ;
-*-DEFAULT &SUB_ASG = 'SHIFT 1' ;
-TYPE STARTDATE = &STARTDATE
-TYPE ENDDATE = &ENDDATE

-SET &BEG_DATE_ISSUED = &STARTDATE | ' 00:00:00.000';
-SET &END_DATE_ISSUED = &ENDDATE | ' 00:00:00.000'; 

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


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 96 | Registered: October 13, 2014Report This Post
Virtuoso
posted Hide Post
-SET &TODAY = &YYMD;
-SET &WEEK = &TODAY - 7;
-TYPE TODAY = &TODAY
-TYPE WEEKAGO = &WEEK
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Gold member
posted Hide Post
I tried this and it does not work. After throwing an error, it seems that the variable &YYMD is not recognized.


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 96 | Registered: October 13, 2014Report This Post
Gold member
posted Hide Post
It does not work with SET or DEFAULT


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 96 | Registered: October 13, 2014Report This Post
Virtuoso
posted Hide Post
It does, but with -DEFAULT you need to .EVAL the value (safe in this case) as it does not evaluate expressions of its own accord.
And it's -SET and -DEFAULT, not SET and DEFAULT. Those are different languages!

But of course you can't just subtract 7 from a numerical date value like Prarie suggested, that will only work after the 8th of each month.

You'll need to calculate the date using the "smart date" functions (DATECVT and DATEADD in this case). Be aware that dialog manager (which the -SET command is part of) does not understand "smart dates", so you'll have to convert it back to something simpler: number or string.

Or you do the calculations in a DEFINE or COMPUTE block in your TABLE request. That's FOCUS code and it does understand "smart dates".

BTW, I think you got your explanation backwards. I assume you meant to set the ENDDATE to the current date and the STARTDATE 7 days ago, otherwise you create a time range that is -7 days long.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Gold member
posted Hide Post
quote:
Originally posted by Wep5622:
It does, but with -DEFAULT you need to .EVAL the value (safe in this case) as it does not evaluate expressions of its own accord.
And it's -SET and -DEFAULT, not SET and DEFAULT. Those are different languages!

But of course you can't just subtract 7 from a numerical date value like Prarie suggested, that will only work after the 8th of each month.

You'll need to calculate the date using the "smart date" functions (DATECVT and DATEADD in this case). Be aware that dialog manager (which the -SET command is part of) does not understand "smart dates", so you'll have to convert it back to something simpler: number or string.

Or you do the calculations in a DEFINE or COMPUTE block in your TABLE request. That's FOCUS code and it does understand "smart dates".

BTW, I think you got your explanation backwards. I assume you meant to set the ENDDATE to the current date and the STARTDATE 7 days ago, otherwise you create a time range that is -7 days long.


Once again, thank you very much for your help!!


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 96 | Registered: October 13, 2014Report This Post
Expert
posted Hide Post
Wep, look up AYMD and AYM functions; You'll enjoy knowing them. perfect for &vars,




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
  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]Set Default Variable

Copyright © 1996-2020 Information Builders