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] (FOC36355) INVALID TYPE OF ARGUMENT #1 FOR USER FUNCTION DATEADD

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] (FOC36355) INVALID TYPE OF ARGUMENT #1 FOR USER FUNCTION DATEADD
 Login/Join
 
Member
posted
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

I am receiving the error on item #2 below:

1) NEWDATE/HYYMDS = HGETC(8, 'HYYMDS');

2) DAYS84/YYMD = DATEADD(NEWDATE,'D',-84);
3) DAYS82/YYMD = DATEADD(NEWDATE,'D',-82);

I am trying to get (current date minus 84 days) so that I can plug it into the following WHERE statement:

-SET &WHERE = IF Num_Date EQ 'FRI' THEN 'WHERE (ENDDATE GE DAYS84 AND ENDDATE LE DAYS82)' ELSE 'WHERE ENDDATE EQ DAYS84';

Any guidance will be appreciated.

This message has been edited. Last edited by: Kerry,
 
Posts: 8 | Registered: August 06, 2007Report This Post
Expert
posted Hide Post
DATEADD works on Date fields (Smart dates)

Either convert your Date Time Stamp to a date or get the current date from another source, e.g. &YYMD.
TABLE FILE CAR
 PRINT COMPUTE
 NDATE/YYMD  = '&YYMD' ;
 NEWDTS/HYYMDS = HGETC(8, 'HYYMDS');
 NEWDATE/YYMD  = HDATE(NEWDTS,'YYMD');
 DAYS84/YYMD = DATEADD(NEWDATE,'D',-84);
 DAYS82/YYMD = DATEADD(NEWDATE,'D',-82);      

 BY COUNTRY NOPRINT
END


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
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.


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
Member
posted Hide Post
Thank,everyone, for responding. This is what I did to resolve my issue:

SYS_DATE/YYMD = &YYMD ;

-*Calculate 84 days back from system date, MDY format
DT1/MDY = DATEADD(SYS_DATE,'D',-84);

-*Calculate 82 days back from system date, MDY format
DT2/MDY = DATEADD(SYS_DATE,'D',-82);

-*Convert ENDDATE database field from YYMD TO MDY
ED1/YYMD = HDATE (ENDDATE,'YYMD');
EDNEW/MDY = DATECVT(ED1,'YYMD','MDY');

-SET &WHERE = IF DAY_OF_WEEK EQ 'FRI' THEN 'WHERE (EDNEW GE DT1 AND EDNEW LE DT2)' ELSE 'WHERE EDNEW EQ DT1';

Thanks again.
 
Posts: 8 | Registered: August 06, 2007Report This Post
Expert
posted Hide Post
Please see my previous post and try to do your date calculations with Dialogue Manager and then use those in your WHERE clause.

As written, if your data source is relational, it is highly unlikely that your WHERE clause will get passed to the relational engine.


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
Gold member
posted Hide Post
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,


------------------------------------------
DevStudio 8.2.03
WFS 8.2.03
 
Posts: 86 | Location: Atlanta | Registered: May 10, 2007Report This Post
Expert
posted Hide Post
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, 2003Report This Post
Gold member
posted Hide Post
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.


------------------------------------------
DevStudio 8.2.03
WFS 8.2.03
 
Posts: 86 | Location: Atlanta | Registered: May 10, 2007Report This Post
Expert
posted Hide Post
Idea 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, 2005Report 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] (FOC36355) INVALID TYPE OF ARGUMENT #1 FOR USER FUNCTION DATEADD

Copyright © 1996-2020 Information Builders