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.
May I have help please resolving a FOC36355 error message? I have tried DATECVT and EDIT without success. I am trying to get the current date minus 84 days so that it is in the same format as ENDDATE which is in HYYMDS format. I need these to be the same format so that I can do the comparison in the WHERE statement below.
(FOC36355) INVALID TYPE OF ARGUMENT #1 FOR USER FUNCTION DATEADD
In addition, depending on your data source, i.e. relational, it is not advisable to do WHERE screens against defined fields. More often than not, the WHERE does not get passed to the backend engine.
The recommended method is to compare against a literal which you can create with Dialogue Manager. There are dozens of posts on this Forum on how to do that. You can try searching on DT or DATE and other common keywords.
msands, It seems that I spend 75% of my time working with dates. I think in the past I have used Where statements in the report calling a &var like your example however lately I have preferred to throw it together in one ugly where statement. (So I don't have to go looking through my code to find where I created the &var.) Actually I usually break my values up into vars and compare &var1 GE FIELD1, etc.
You could do it something like this.
I don't know where you get DAY_OF_WEEK and ENDDATE so I just coded them as variables. &DAY_OF_WEEK = text &ENDDATE = I8YYMD For the comparison I usually just convert everything to YYMD but I see you like MDY so I'll give that a shot.
-*-SET &DAY_OF_WEEK = 'THR';
-*-SET &ENDDATE = 20090325;
TABLE FILE CAR
PRINT
COMPUTE NDATE/YYMD = DATECVT(&YYMD,'I8YYMD','YYMD');
COMPUTE DAY_OF_WEEK/A5 = '&DAY_OF_WEEK';
-*SIMPLIFIED THE FOLLOWING TWO LINES WITH SMARTDATE DAY SUBTRACTION
-* COMPUTE DAYS84/YYMD = DATEADD(NDATE,'D',-84);
-* COMPUTE DAYS82/YYMD = DATEADD(NDATE,'D',-82);
COMPUTE DAYS84/YYMD = NDATE-84;
COMPUTE DAYS82/YYMD = NDATE-82;
BY COUNTRY NOPRINT
-*CHANGED FOLLOWING LINE TO USE SIMPLE SMARTDATE DAY AJUSTMENT INSTEAD OF DATEADD() FUNCTION.
-*WHERE ( ( ( '&DAY_OF_WEEK' EQ 'FRI' ) AND ( ( DATECVT(&ENDDATE,'I8YYMD','MDY') GE DATEADD(DATECVT(&YYMD,'I8YYMD','MDY'),'D',-84) ) AND ( DATECVT(&ENDDATE,'I8YYMD','MDY') LE DATEADD(DATECVT(&YYMD,'I8YYMD','MDY'),'D',-82) ) ) ) OR ( ('&DAY_OF_WEEK' NE 'FRI') AND ( DATECVT(&ENDDATE,'I8YYMD','MDY') EQ DATEADD(DATECVT(&YYMD,'I8YYMD','MDY'),'D',-84) ) ) );
WHERE ( ( ( '&DAY_OF_WEEK' EQ 'FRI' ) AND ( ( DATECVT(&ENDDATE,'I8YYMD','MDY') GE (DATECVT(&YYMD,'I8YYMD','MDY')-84) ) AND ( DATECVT(&ENDDATE,'I8YYMD','MDY') LE (DATECVT(&YYMD,'I8YYMD','MDY')-82) ) ) ) OR ( ('&DAY_OF_WEEK' NE 'FRI') AND ( DATECVT(&ENDDATE,'I8YYMD','MDY') EQ (DATECVT(&YYMD,'I8YYMD','MDY')-84) ) ) );
HEADING
"Day of the week is &DAY_OF_WEEK"
"Enddate is &ENDDATE"
END
Sorry it got ugly.
OH, and something I learned the hard way is do not try storing ampervars as smart dates using set commands. It likes alpha or integer. It's ok to use smart dates functions within a set calculation I just always try to convert it back to a integer before storing it as an ampervar.This message has been edited. Last edited by: trob,
gosh i just ADD the number of days, once i have a smart date (anything YYMD), to add, you just NEWDATE/YYMD = OLDDATE - 84 ; that's the beauty of smart dates (yymd) then if i want to convert, its just an edit mask NEWERDATE/MDY=NEWDATE; or NEWERDATE/MtDYY = NEWDATE ; i like that display ... all these smartdate formats are just masks on the underlying 5 digit epoch value contained in the smartdate field, no DATECVT needed.
Getting an &YYMD into a smart date, i just do it the old fashioned way temp/I8YYMD = &YYMD ; OLDDATE/YYMD = temp;
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
Nice point Susannah. I got so caught up in using DATEADD I didn't really even think about the fact we were just adding days. I'm use to adjusting month and years.
Thanks for the succinct explanation of Smart Dates. I know what they are and how to use them. But your brief explanation,yet simple, explanation helps us all to see dates in a clearer light.
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005