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] Supplying -DEFAULT values with amper variables

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Supplying -DEFAULT values with amper variables
 Login/Join
 
Platinum Member
posted
Is it possible to get -DEFAULT to assign a value to a variable from another variable? For example

-DEFAULT &YEAR = &DATEYY;

does not work.

-SET &YEAR = &DATEYY;

does work, but I need to use -DEFAULT.

Any suggestions?

Thanks,

John

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


WF 7.7.03, Windows 7, HTML, Excel, PDF
 
Posts: 225 | Location: San Francisco Bay Area, California | Registered: October 26, 2006Report This Post
Virtuoso
posted Hide Post
-DEFAULT is used to set a value in case no other value is supplied. You're wanting to supply a value. What I usually do is

-DEFAULT &YEAR=' '
-SET &YEAR=IF &YEAR EQ '' THEN &DATEYY ELSE &YEAR;

When you reference &YEAR later in your procedure, you would use &YEAR.EVAL

If year is not populated, it defaults to &DATEYY. Otherwise it uses the value of &YEAR that was supplied.

This message has been edited. Last edited by: Darin Lee,


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
Platinum Member
posted Hide Post
Thank you, Darin.

I tried your technique, but the drop-down list defaults to 2005, the first value in the WHERE statement (show below).

With -DEFAULT &YEAR = 2007; the drop down list defaults to 2007.

WHERE FISCAL_YEAR EQ &PREV_YEAR OR &YEAR.2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020).Please select a year.;

I'd like the drop-down list to always default to the current year, without having to hard-code the the value in the -DEFAULT.

Regards,

John


WF 7.7.03, Windows 7, HTML, Excel, PDF
 
Posts: 225 | Location: San Francisco Bay Area, California | Registered: October 26, 2006Report This Post
Virtuoso
posted Hide Post
John

DEFAULTS cannot be set to another &variable, it will just contain the name of the &variable.

However, try:
  
-SET &YY=EDIT(&YYMD,'9999');
.DEFAULTS &YEAR = 0
-SET &YEAR = IF &YEAR EQ 'CURRENT' THEN &YY ELSE &YEAR;
.
.
WHERE FISCAL_YEAR EQ &PREV_YEAR OR &YEAR.(CURRENT,2005,2006,2007,2008,2009,2010,2011).Please select a year.;
.
.

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
Not sure what release or context in which you are trying to use the -DEFAULT, but have you tried:

-DEFAULT &YEAR = &DATEYY.EVAL;

Works when I run the fex and -TYPE the variable.
 
Posts: 118 | Location: DC | Registered: May 13, 2005Report This Post
Platinum Member
posted Hide Post
This is WebFOCUS 7.1.3.

I tried both of the above techniques. We're getting closer. The report output shows that it defaults to the current year, but the drop-down list in the parameters section of the output window still defaults to the first value, 2005. Eventually this report will have a launch page. Can something been done with the launch page so it will default to the current year?

Thanks,

John


WF 7.7.03, Windows 7, HTML, Excel, PDF
 
Posts: 225 | Location: San Francisco Bay Area, California | Registered: October 26, 2006Report This Post
Virtuoso
posted Hide Post
codermonkey

This may work in a type statement, but NOT in auto prompt, where you will see the &DATEYY.EVAL appear in the select. Auto prompt does not evaluate &variables. The DEFAULT &variable only contains the value &DATEYY.EVAL, which is then evaluated in the type statement.

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
John

I have tested this, exactly as I coded it, and the select should have CURRENT as the first value, with that value selected, and when the user submits the report, the value CURRENT is changed to 2007, or whatever the current year is.

If you mean a self service launch page, then you can do almost anything as you, not auto prompt, is in control. It really depends how you want to code the launch page, how much work WebFOCUS does and how much work javascript does.

I have submitted an article for Focal Point which covers this topic in quite a lot of detail.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
autoprompt strikes again!!
Alan's suggestion looks the most promising as a quick fix. However, as he also suggests, creating a launch page for this changes the issue completely.
I am assuming that you will also want the list of years to be a moving range, so you don't have do go back and edit it in 5 or ten years to add some more years. In which case you need some sort of a control other than a simple drop down box, or else some javascript to determine the values. In either case you can add "selected" in the
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
Regarding the "moving range" (Darin 3/13/2007 11:52) in the calendar: movine dates (AKA: a date range) can be set when the variable is associated with the calendar control. This does not display a different date based on the system date which is part of this topic. However, the calendar control does allow for a dynamic date range.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
Actually, it can be used with a dynamic range based on the system date. If the control is set to a relative date (e.g. +/- 5 years) then it takes the system date and gives all dates within -5 to +5 years of the system date.

From the manual:
Relative. This option allows the developer to set a specific number of days, months, and years relative to the current date. The current date (at run time) will always be the reference or starting point and the calendar will show a number of days, months, and years relative to the current date. The range could be all in the past (for example, five years prior to the current date) or all in the future (for example, five years in the future).


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
Virtuoso
posted Hide Post
I remember a post on this site where somebody creates an include file that is recalculated every night.

The file holds lines like

-DEFAULT &YESTERDAY='20080902';

The other solution is to put these many times used amper values in double ampers in your system startup proces.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Guru
posted Hide Post
Actually in DevStudio, the Calendar allows you to use a 'relative' range of dates which will change with the system date.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Expert
posted Hide Post
John,
here's how we do this...its in our coding standards;
in the fex:
-SET &somedate = whatever function you want;
-DEFAULT &STARTDATE = &somedate.EVAL ;

..then in the launch page
1) the variable for STARTDATE will say value="&somedate.EVAL"
yuck.
erase that!
so it says value=""
2) initialize that value with a nice little piece of javascript, like this:
function setToday (){
var today      = new Date();
var s1 = '';
var s2 = '';
 if ((today.getMonth()-1) <10 ) s1='0';
 if (today.getDate() < 10)    s2='0';
thisday=s1+(today.getMonth()+1)+s2+today.getDate()+today.getFullYear();

document.nameForm.STARTDATE.value = thisday;
}
</SCRIPT>

make sure this goes into your BODY tag
onLoad=setToday();

If your launch page uses forms, change the word .nameForm to your form name.
If your launch page doesn't use frames, then replace document.nameForm. with this.

I don't use ibi calendar. It won't launch on top of a small frameset. so from a design pov, its ng; I use a really really sweet calendar , you can find if you google 'javascript calendar tigra'; its totally customizable, colors placement, etc. Even works with European date formats...{somebody's gotta keep T and Frank happy }
the .js method of seeding your startdate works with both/either/neither.

Just make sure your .js creates the same default start date as does your fex's dialog manager. Would be *nice* if they matched Wink
-S

the *other* way to do it is to select 'dynamic' in devstu for your date parameter.
then select 'procedure' rather than masterfile.
and write your own little fex that will run and produce the .xml file , where the first year in the list is always the current year.
All the fex has to do is
TABLE FILE ...
PRINT FANCYDATE BY HIGHEST MYDATE
ON TABLE PCHOLD FORMAT XML
END
... and that's it. sweet. you can work out the bits to -WRITE a file with this year, last year, however many you want back.
"MYDATE" here is the actual value you're passing; "FANCYDATE" is the value you're showing in the select box.
Make sure the little fex is in the app path so the .htm can find it.
I haven't tried forcing a SELECTED using this method, and i haven't tried putting the ALL option at the end of the list where i *want* it with this method. But i'm going to do that someday. (oh wow, i just realized that's how i could avoid the dreaded FOC_NONE mess! oh i'm so glad you asked this question)
warning. devstu 766 is a hot mess, it doesn't chain, it doesn't pick displayvalues,

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




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
Member
posted Hide Post
Just for the record, multiple SETs also work for multiple DEFAULTs. Only if closed with a ;

-SET &CAL_YR_WEEK = 200850;
-SET &PREV_CAL_YR_WEEK = &CAL_YR_WEEK - 100;
-*result: &PREV_CAL_YR_WEEK = 200750 (yyyyww)

This also works. Single DEFAULT and multiple SETs.

-DEFAULT &CAL_YR_WEEK = 200850;
-SET &PREV_CAL_YR_WEEK = &CAL_YR_WEEK - 100;
-SET &CAL_YR_LAST_WK = &CAL_YR_WEEK - 1;


WebFOCUS 7.6.11, Windows XP, Excel, HTML, PDF
 
Posts: 25 | Location: Salt Lake City | Registered: June 03, 2008Report 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] Supplying -DEFAULT values with amper variables

Copyright © 1996-2020 Information Builders