Peter Vazny Posted March 19, 2021 Share Posted March 19, 2021 I am trying to display a date value that was selected through auto prompt in the report header, but I want to change the format. It currently comes over as MtrDYY, but I would like just simple MDY. And as I was typing this I thought about the 10th iteration of HINPUT and was able to get a date out of the autoprompt. But I would still like to know if this is the only way. This is what worked for me: HINPUT(30, '&INPUT_DATE', 8, OUTPUT_FIELD) I really picked the 30 at random because I am not sure how to figure out how long the parameter is. Are all parameters returned as text Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 19, 2021 Author Share Posted March 19, 2021 Well just as I submitted it I thought about another way. Just adding the .QOUTEDSTRING at the end. For anybody that is searching, just create a new Detail (Define) field with desired date format and this expression: &INPUT_DATE.QUOTEDSTRING Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 19, 2021 Author Share Posted March 19, 2021 Well I am still having trouble converting that date into a string of desired date format. It should not be this difficult to find things. Link to comment Share on other sites More sharing options...
Martin Yergeau Posted March 19, 2021 Share Posted March 19, 2021 Can you share your code or reproduce using CAR file Link to comment Share on other sites More sharing options...
Debra Waybright Posted March 19, 2021 Share Posted March 19, 2021 Have you tried using EDIT Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 19, 2021 Author Share Posted March 19, 2021 I tried to reproduce the IBISAMP route, but it only seems to be including legacy dates and the auto prompts dont work for that at all. Here is the code reproduced in Retail -*COMPONENT=Define_wf_retail_tiny DEFINE FILE retail_samples/wf_retail_tiny SelectedDateAfter/A30=IF '&DATE_AFTER' EQ '_FOC_NULL' THEN 'Any' ELSE &DATE_AFTER.QUOTEDSTRING; SelectedDateBefore/A30=IF '&DATE_BEFORE' EQ '_FOC_NULL' THEN 'Any' ELSE &DATE_BEFORE.QUOTEDSTRING; END ENGINE INT CACHE SET ON SET PAGE-NUM=NOLEAD SET SQUEEZE=ON -DEFAULTH &WF_HTMLENCODE=ON; SET HTMLENCODE=&WF_HTMLENCODE SET HTMLCSS=ON -DEFAULTH &WF_EMPTYREPORT=ON; SET EMPTYREPORT=&WF_EMPTYREPORT -DEFAULTH &WF_ARVERSION=1; SET ARVERSION=&WF_ARVERSION -DEFAULTH &WF_SUMMARY='Summary'; -DEFAULTH &WF_TITLE='WebFOCUS Report'; -DEFAULT &DATE_AFTER = _FOC_NULL; -DEFAULT &DATE_BEFORE = _FOC_NULL; TABLE FILE retail_samples/wf_retail_tiny BY WF_RETAIL_TINY.WF_RETAIL_SHIPMENTS.ID_SHIPFACT BY WF_RETAIL_TINY.WF_RETAIL_SHIPPING_OPTIONS.COURIER BY WF_RETAIL_TINY.WF_RETAIL_TIME_SHIPPED.TIME_DATE WHERE WF_RETAIL_TINY.WF_RETAIL_TIME_SHIPPED.TIME_DATE GE &DATE_AFTER.(|FORMAT=YYMD).Shipped after:.QUOTEDSTRING; WHERE WF_RETAIL_TINY.WF_RETAIL_TIME_SHIPPED.TIME_DATE LE &DATE_BEFORE.(|FORMAT=YYMD).Shipped before:.QUOTEDSTRING; WHERE WF_RETAIL_TINY.WF_RETAIL_SHIPPING_OPTIONS.COURIER EQ &COURIER.(FIND WF_RETAIL_TINY.WF_RETAIL_SHIPPING_OPTIONS.COURIER IN RETAIL_SAMPLES/WF_RETAIL_TINY |FORMAT=A25V,SORT=ASCENDING,REQUIRED=TRUE).Shipping Company:.QUOTEDSTRING; WHERE RECORDLIMIT EQ 100; ON TABLE SUBHEAD "Selected dates from: <SelectedDateAfter<+0> to: <SelectedDateBefore<+0> " ON TABLE PCHOLD FORMAT HTML ON TABLE NOTOTAL ON TABLE SET CACHELINES 100 ON TABLE SET GRWIDTH 1 ON TABLE SET STYLE * ENDSTYLE END -RUN the ON TABLE SUBHEAD displays Selected dates from: January 01 2016 to: Any I want to display Selected dates from: 01/01/2016 to: Any Link to comment Share on other sites More sharing options...
David Beagan Posted March 19, 2021 Share Posted March 19, 2021 It seems really strict about having _FOC_NONE in the Define I dont see a way around having Dialogue Manager: -SET &DATE_AFTER = IF &DATE_AFTER EQ '_FOC_NULL' THEN '0' ELSE &DATE_AFTER; -SET &DATE_BEFORE = IF &DATE_BEFORE EQ '_FOC_NULL' THEN '0' ELSE &DATE_BEFORE; Then this in the Define: SelectedDateAfter/MDYY ='&DATE_AFTER'; SelectedDateBefore/MDYY ='&DATE_BEFORE'; A8MDYYDateAfter/A8MDYY = SelectedDateAfter; A8MDYYDateBefore/A8MDYY = SelectedDateBefore; StringDateAfter/A10 = IF '&DATE_AFTER' EQ '0' THEN 'Any' ELSE EDIT(A8MDYYDateAfter,'99/99/9999'); StringDateBefore/A10 = IF '&DATE_BEFORE' EQ '0' THEN 'Any' ELSE EDIT(A8MDYYDateBefore,'99/99/9999'); Then your SUBHEAD would be: "Selected dates from: <StringDateAfter<+0> to: <StringDateBefore<+0> " Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 19, 2021 Author Share Posted March 19, 2021 I retried to the best of my ability and understanding how EDIT works but all I get is this: Detail: ERROR AT OR NEAR LINE 10 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC177) INVALID DATE CONSTANT: '_FOC_NULL' ERROR AT OR NEAR LINE 10 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: SelectedDateDate ERROR AT OR NEAR LINE 11 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: SelectedDateDate ERROR AT OR NEAR LINE 12 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: SelectedDateText ERROR AT OR NEAR LINE 10 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC177) INVALID DATE CONSTANT: '_FOC_NULL' ERROR AT OR NEAR LINE 10 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: SelectedDateDate ERROR AT OR NEAR LINE 11 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: SelectedDateDate ERROR AT OR NEAR LINE 12 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: SelectedDateText (FOC804) REFERENCED OBJECT <SelectedDateBefore> IS NOT FOUND IN MFD <WF_RETAIL_TINY> (FOC009) Request failed validation, not executed. The code behind that: SelectedDateDate/MDY=&DATE_BEFORE.QUOTEDSTRING; SelectedDateText/A10=EDIT(SelectedDateDate); SelectedDateBefore/A30=IF '&DATE_BEFORE' EQ '_FOC_NULL' THEN 'Any' ELSE SelectedDateText ; Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 19, 2021 Author Share Posted March 19, 2021 david.beagan: I dont see a way around having Dialogue Manager Is dialog manager just another .fex file From the description of it in the documentation I fail to see a difference between it and the code that InfoAssist generates. I tried to put the -SET lines in the code, but it did not work. If I put them bellow -DEFAULT it fails with a _FOC_NULL error. If I put them above DEFINE, it runs but returns no records regardless of the date choice. In either case, this will probably make the report un-editable in InfoAssist, am I correct This is whats frustrating about this product. Everything is a dirty hack. Link to comment Share on other sites More sharing options...
David Beagan Posted March 19, 2021 Share Posted March 19, 2021 peter.vazny: This is whats frustrating about this product. Everything is a dirty hack. Yea, I hear you. I was a bit surprised that you couldnt use _FOC_NULL in a Define. Dialogue manager is the commands that start with a such as: -DEFAULT as well as the amper variables. To learn more see Chapter 5 of Developing Reporting Applications 8206. I will look into it a bit more to see if there is a way to still allow it to be edited by InfoAssist. Link to comment Share on other sites More sharing options...
Martin Yergeau Posted March 19, 2021 Share Posted March 19, 2021 peter.vazny: SelectedDateDate/MDY=&DATE_BEFORE.QUOTEDSTRING; SelectedDateText/A10=EDIT(SelectedDateDate); SelectedDateBefore/A30=IF &DATE_BEFORE EQ _FOC_NULL THEN Any ELSE SelectedDateText ; Instead of above, can you try with SelectedDateDate/MDY=IF '&DATE_BEFORE.EVAL' EQ '_FOC_NULL' THEN 12312099 ELSE &DATE_BEFORE.QUOTEDSTRING; SelectedDateText/A10=FPRINT(SelectedDateDate, 'MDY', 'A10'); SelectedDateBefore/A30=IF '&DATE_BEFORE.EVAL' EQ '_FOC_NULL' THEN 'Any' ELSE SelectedDateText ; Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 19, 2021 Author Share Posted March 19, 2021 MartinY: Instead of above, can you try with That still throws an error if no date is selected. (FOC177) INVALID DATE CONSTANT: '_FOC_NULL' Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 19, 2021 Author Share Posted March 19, 2021 Aaaand after about 300 iterations to figure out just the right combination of workarounds, I present to you the solution: SelectedDateBeforeTD/HYYMDS=HINPUT(CHAR_LENGTH(&DATE_BEFORE.QUOTEDSTRING),&DATE_BEFORE.QUOTEDSTRING,8,SelectedDateBeforeTD); SelectedDateBeforeMDY/MDY=HDATE(SelectedDateBeforeTD,'YYMD'); SelectedDateBeforeA8/A8=FPRINT(SelectedDateBeforeMDY,'MDY','A8'); SelectedDateBefore/A30=IF '&DATE_BEFORE.EVAL' EQ '_FOC_NULL' THEN 'Any' ELSE SelectedDateBeforeA8 ; SelectedDateAfterTD/HYYMDS=HINPUT(CHAR_LENGTH(&DATE_AFTER.QUOTEDSTRING),&DATE_AFTER.QUOTEDSTRING,8,SelectedDateAfterTD); SelectedDateAfterMDY/MDY=HDATE(SelectedDateAfterTD,'YYMD'); SelectedDateAfterA8/A8=FPRINT(SelectedDateAfterMDY,'MDY','A8'); SelectedDateAfter/A30=IF '&DATE_AFTER' EQ '_FOC_NULL' THEN 'Any' ELSE SelectedDateAfterA8; Thanks to everybody for chipping in Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 20, 2021 Author Share Posted March 20, 2021 And of course, this breaks aggregation 09.30.09.341800 (FOC2590) AGGREGATION NOT DONE FOR THE FOLLOWING REASON: 09.30.09.341840 (FOC2565) THE OBJECT SelectedDateAfter OF MAX CANNOT BE CONVERTED TO SQL 09.30.09.341864 (FOC2566) DEFINE SelectedDateAfterA10 CANNOT BE CONVERTED TO SQL 09.30.09.341888 (FOC2567) FUNCTION FPRINT CANNOT BE CONVERTED TO SQL I dont understand why this came into play at all. None of the defines touch anything in the data. This is purely messing with amper values. I give up Link to comment Share on other sites More sharing options...
David Beagan Posted March 21, 2021 Share Posted March 21, 2021 In my testing I was able to accomplish this by breaking the report into two fexes. One fex handles Dialogue Manager to set variables for displaying in the Subhead. The other is the InfoAssist report, without any Defines for the subheading, that can be edited in InfoAssist. Here is the code for the first fex which calculates two variables for display in the Subhead. DEFINE FUNCTION DATESHOW (Date/A17) DateHYYMDS/HYYMDS = HINPUT(17, Date, 8, DateHYYMDS); DateMDY/MDY = HDATE(DateHYYMDS, 'YYMD'); DATESHOW/A8V = IF Date EQ '_FOC_NULL' THEN 'Any' ELSE FPRINT(DateMDY, 'MDY', 'A8'); END -RUN -SET &DATE_AFTER_SHOW = DATESHOW(&DATE_AFTER); -SET &DATE_BEFORE_SHOW = DATESHOW(&DATE_BEFORE); -INCLUDE IBFS:/WFC/Repository/Public/ia_reports/autoprompt_date_ia.fex Then the -INCLUDE runs the InfoAssist report. In the Subhead you would have: Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 22, 2021 Author Share Posted March 22, 2021 Thank you, that is interesting approach. Unfortunately that will not work for us in this situation. I will keep that in my toolset though. However I was able to trick the beast via COMPUTE. Link to comment Share on other sites More sharing options...
Peter Vazny Posted March 22, 2021 Author Share Posted March 22, 2021 So after mulling it over for a while and a few dozen of additional iterations I was able to get the date formatted and keep the aggregation. DateAfterText/A17=IF &DATE_AFTER.QUOTEDSTRING EQ '_FOC_NULL' THEN '' ELSE &DATE_AFTER.QUOTEDSTRING; DateBeforeText/A17=IF &DATE_BEFORE.QUOTEDSTRING EQ '_FOC_NULL' THEN '' ELSE &DATE_BEFORE.QUOTEDSTRING; ... COMPUTE DateAfterHeading/A10=IF DateAfterText EQ '' THEN 'Any' ELSE EDIT2(HDATE(HINPUT(17,DateAfterText ,8,'HMDYY'),'MDYY'),'MDYY'); NOPRINT COMPUTE DateBeforeHeading/A10=IF DateBeforeText EQ '' THEN 'Any' ELSE EDIT2(HDATE(HINPUT(17,DateBeforeText ,8,'HMDYY'),'MDYY'),'MDYY'); NOPRINT ... "Selected dates from: <DateAfterHeading<+0> to: <DateBeforeHeading<+0> " Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now