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     How to get yesterday's date

Read-Only Read-Only Topic
Go
Search
Notify
Tools
How to get yesterday's date
 Login/Join
 
Member
posted
Hi,
I want to find out yesterdaty's date. I'm trying this code:
DEFINE FILE A2PER1
THISDATE/A8YYMD WITH PTNO = EDIT('&YYMD','99999999');
THIS_DATE/I8YYMD WITH PTNO = EDIT(THISDATE);
YESTERDAY/I8YYMD WITH PTNO = AYMD(THIS_DATE,-1,YESTERDAY);
YESTERDAY1/MDYYTR WITH PTNO = YESTERDAY;
END
and when I print the dates, it gives me blank.
Please help.


7.1.6
Win XP
HTML
 
Posts: 16 | Registered: February 29, 2008Report This Post
Virtuoso
posted Hide Post
I put your code in a define against the car file and it worked just fine. I also did a less steps version straight use of smart dates.

TESTTWO/YYMD = '&YYMD';
TESTTHREE/YYMD = TESTTWO - 1;


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Member
posted Hide Post
Thanks Leah,
I tried to use your code i.e.
DEFINE FILE A2PER1 CLEAR
TESTTWO/YYMD = '&YYMD';
TESTTHREE/YYMD = TESTTWO - 1;
END
now i'm getting

DEFINE FILE A2PER1 CLEAR
TESTTWO/YYMD = '&YYMD';
(FOC177) INVALID DATE CONSTANT: ;
TESTTHREE/YYMD = TESTTWO - 1;
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: TESTTWO
END
Please advise.


7.1.6
Win XP
HTML
 
Posts: 16 | Registered: February 29, 2008Report This Post
Expert
posted Hide Post
Take the quotes off &YYMD.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Master
posted Hide Post
As always, there are multiple ways to do things like this:

-SET &YESTERDAY=AYMD(&YYMD,-1,'I8YYMD');
DEFINE FILE A2PER1 CLEAR
TESTTHREE/YYMD = &YESTERDAY;
END


Now the previous day is available to the whole fex without having to recompute it everytime it is needed.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Member
posted Hide Post
TODAY/MDYY = &MDYY ;
YESTERDAY/MDYY = DATEADD(TODAY, 'D', -1);


7.7.03
 
Posts: 5 | Location: Somewhere near the Crab Nebula | Registered: September 05, 2007Report This Post
Virtuoso
posted Hide Post
quote:
now i'm getting

DEFINE FILE A2PER1 CLEAR
TESTTWO/YYMD = '&YYMD';
(FOC177) INVALID DATE CONSTANT: ;
...


How are you executing this code?

The echo of a fex would not show '&YYMD', it would list the substituted value ('20080507').

If this is executing in a context that does not recognize Dialog Manager variables (e.g. reading from std input, or executing a file via a FILEDEF ddname), the FOC177 is appropriate: the alpha expression '&YYMD' is not a valid date value.

quote:
Take the quotes off &YYMD


No, the quotes are appropriate.

You can assign a literal value to a smart date in the form of either a date literal or an integer constant representing a date offset.

After the substitution for &YYMD,

='20080507';
unambiguously provides a date value.

But
=20080507;
is ambiguous -- it can be interpreted either as a yyyymmdd date, or as an offset. -- The present behavior of Focus depends on the value: integer values that could be calendar dates are treated as date constants (as if they were quoted); otherwise the value is treated as an offset.

The range of "could be" dates is unspecified and the cutoff points are arbitrary (is 01001231 a very early date, or the offset of a far-off future date?)

-- But AFAIK the interpretation of some unquoted integer values as dates and others as offsets is undocumented, and subject to code tightening without notice.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
Hi,

I used this for a similar need:

-SET &YESTER = DATECVT((DATEADD((DATECVT(&TODAY,'I8YYMD','YYMD')), 'D', -1)), 'YYMD','I8YYMD');


7.6.11
Windows
HTML, PDF, Excel etc
DevStudio/Webfocus/Focus IBM
SQL Server 2000 / 2008
DB2
 
Posts: 78 | Location: UK | Registered: February 07, 2008Report This Post
Gold member
posted Hide Post
MYDATE/YYMD = '&YYMD' ;

should always work. E.g.

DEFINE FILE CAR
MYDATE/YYMD WITH COUNTRY = '&YYMD' ;
END
-RUN
TABLE FILE CAR
PRINT MYDATE
IF RECORDLIMIT EQ 1
END
-RUN

In your case, &YYMD seems to be garbage. Try executing with ECHO=ON.


IBI Development
 
Posts: 61 | Registered: November 15, 2005Report This Post
Master
posted Hide Post
quote:
THISDATE/A8YYMD WITH PTNO = EDIT('&YYMD','99999999');
THIS_DATE/I8YYMD WITH PTNO = EDIT(THISDATE);

Try changing it to: THIS_DATE/I8YYMD =&YYMD;


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report 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     How to get yesterday's date

Copyright © 1996-2020 Information Builders