Focal Point
[CLOSED] Calender Chaining

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3827080396

April 10, 2020, 12:20 AM
Krishna.edara
[CLOSED] Calender Chaining
Hi,
I have created two calendars, one for start date and one for end date through HTML Layout painter, how do I control the end date selection based on the start date selection
Ex: End date should be always maximum of 90 days from the start date user selected from Calendar but user may select any date less than 90.

any idea ?

Thanks,
Krishna

This message has been edited. Last edited by: FP Mod Chuck,


WebFocus-8/Windows/HTML, PDF, EXCEL
April 10, 2020, 04:13 PM
Doug
Hello Krishna.edara,

My first thought is that if "End date should be always maximum of 90 days from the start date" then you do not need two calendars.
The 2nd calendar would only be a nuisance. You can use the DATEADD function to automagically add 90 days to the selected date from the first calendar.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
April 10, 2020, 05:04 PM
FP Mod Chuck
Krishna

I was able to get this to work with the html composer. The first calendar control under the setting tab I checked Current/Start Date and Send unformatted value and left it as Static at the top. In the second calendar control I used a dynamic procedure with the following syntax.


-DEFAULTH &START_DATE = &YYMD.EVAL;
-SET &SD_PLUS90 = AYMD(&START_DATE,+90,'I8YYMD');
DEFINE FILE WF_RETAIL
SD_PLUS90/YYMD = &SD_PLUS90;
END
TABLE FILE WF_RETAIL
SUM SD_PLUS90
REVENUE_US
BY SD_PLUS90
ON TABLE PCHOLD FORMAT XML
END


You will have to add this procedure under the requests and datasources tab as an external procedure before you can reference it under the settings.

My syntax for the WHERE condition in the report fex is very simple.

WHERE ( WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE GT '&START_DATE') AND ( WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE LE '&END_DATE' );


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
April 13, 2020, 11:24 PM
dbeagan
If you are looking to limit the second calendar control to only allow selection of certain dates (only allow dates from the start date to start date + 90 days), it looks like there was a feature added starting in 8.2.04 called limit by data. From the App Studio User's Manual:

Limit by data. This option limits the available dates to those that appear in the
data source for the control. For example, if you set the Data Type in the Settings
panel to Dynamic and select a data source and date field for the control, then only
the dates listed in that field will be available for selection.


WebFOCUS 8.2.06
April 14, 2020, 12:08 PM
Krishna.edara
Thank you both for your inputs,
I followed exactly what Chuck gave instructions for end date calendar but it is not working
here are my steps that I followed
1) created a fex file with the following code

 -DEFAULTH &START_DATE = &YYMD.EVAL;
-SET &SD_PLUS90 = AYMD(&START_DATE,+90,'I8YYMD');
DEFINE FILE CAR
SD_PLUS90/YYMD = &SD_PLUS90;
END
TABLE FILE CAR
SUM SD_PLUS90
CAR
BY SD_PLUS90
ON TABLE PCHOLD FORMAT XML
END 


2) Created a HTML page with 2 calendars in it,
one is start_date and other one is end_date

3)I selected Static and check the current/satart date for start_date and date format is YMD
4) added end_date fex file through the requests & Data sources, their I can see sd_plus90 and car columns
5) I selected Dynamic and explicit, I can see the end_date fex from the request dropdown, I choose the sd_plus90 on both value from display from options
6) I chained the start_date and end_date in Parameters page

Please let me know where I`m doing wrong

I can not use database columns as a source for these date selections for various reasons like these dates represents more than one column when I pass this parameters to the my reports as filter.


Thanks,
Krishna.

This message has been edited. Last edited by: Krishna.edara,


WebFocus-8/Windows/HTML, PDF, EXCEL
April 14, 2020, 12:33 PM
FP Mod Chuck
Krishna

On bullet 3 you say you are using YMD and the fex is creating a YYMD. Your last comment is what concerns me as the fields you are testing the start and end date selections against must be date fields or this won't work.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
April 14, 2020, 12:50 PM
Krishna.edara
Chuck,

I changed the format to YYMD, still same,

Yes I`m passing start_date and end_date parameters to the Date fields in the back end reports,

seems like end_date parameter is not able to load the values from the fex i created, instead it is populating all the dates (as we are expecting maximum 90days from the starting date)

Thanks,
Krishna.


WebFocus-8/Windows/HTML, PDF, EXCEL
April 14, 2020, 01:09 PM
FP Mod Chuck
Can you run the fex that creates the sd_plus90 field standalone and see the xml data output? I ran your code on my system and it worked fine but just want to make sure you are getting results from running that code.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
April 14, 2020, 03:02 PM
Krishna.edara
Yes, My fex returns data when I run stand alone and I can see the end date 20200713 which is 90 days from now, that is what we are expecting too, but this data is not reflecting in Calendar, not sure why?

Thanks,
Krishne


WebFocus-8/Windows/HTML, PDF, EXCEL
April 14, 2020, 05:00 PM
FP Mod Chuck
Krishna

I am not sure either it is working for me with 8.2.06. What version are you using? Make sure the calendar control has the date format of YYMD


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
April 14, 2020, 05:39 PM
Krishna.edara
Chuck,

I'm using 8206 version

Thanks,
Krishna


WebFocus-8/Windows/HTML, PDF, EXCEL
April 14, 2020, 05:49 PM
FP Mod Chuck
I wish I knew what happened based on what you wrote you followed my instructions. Make sure your variable for the start date is &START_DATE case sensitive.

You may need to open a case with techsupport so they can take a look with a remote session.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats