Guest Posted May 10, 2021 Share Posted May 10, 2021 Hi John I think youre talking about datepicker.jsp. Its been a while since I used that. Heres something that might help: jquery ui - How to set a default month for datepicker when unselecting all dates - Stack Overflow Link to comment Share on other sites More sharing options...
John Edwards 2 Posted May 10, 2021 Author Share Posted May 10, 2021 Im looking to have a calendar field default to 14 days ago. As-is it defaults to today, and I can set it to a particular date like 01/01/2021, but Id like it to default to 14 days ago. Question Is this possible Link to comment Share on other sites More sharing options...
John Edwards 2 Posted May 11, 2021 Author Share Posted May 11, 2021 Does IBs screen painter use datepicker.jsp None of the materials in the Helpful Link url on that page looks familiar. It used to be dyncalendar, dont know if it still is. Link to comment Share on other sites More sharing options...
Toby Mills Posted May 11, 2021 Share Posted May 11, 2021 Hi John I dont really know since I do so much admin work lately. Were using datepicker at my current site, so thats what popped in my mind. But - we also have a strong javascript guy that wrote those screens. The other folks here will undoubtedly have a better answer for you. What release are you on A quick look around yielded this - maybe itll be helpful for you Setting Dynamic Default Values for Filter Controls https://kb.informationbuilders.com/topic/personalizing-default-values-filter-controls-8207 One of our good front-end myibi members will be able to help. Toby Link to comment Share on other sites More sharing options...
David Beagan Posted May 11, 2021 Share Posted May 11, 2021 The link Toby provided is for a control in Designer. Are you working in Designer Link to comment Share on other sites More sharing options...
Warren Hinchliffe Posted May 11, 2021 Share Posted May 11, 2021 Yes, more info or screen shots would be great. There are many options in WebFOCUS for Date controls and all are handled differently Link to comment Share on other sites More sharing options...
John Edwards 2 Posted May 11, 2021 Author Share Posted May 11, 2021 Yes, Im working in Designer. How do I set it to default to 14 days ago when the screen opens please Link to comment Share on other sites More sharing options...
David Beagan Posted May 11, 2021 Share Posted May 11, 2021 The basic idea is that in Designer, the properties for a control has a Default value entry. You put in a global variable for the default value, for example, &&Date14. This global variable needs to have its value established before the Designer page runs. -SET &&Date14 = AYMD(&DATEH8, -14, 'I8YYMD'); This could be done in the global server profile (edasprof.prf). Or it could be done in a fex you designate to run on user sign-in: Administration Console / Application Settings / Other / Paths to be executed on user Sign-on and enter the path to the fex, IBFS:/WFC/Repository/ . Link to comment Share on other sites More sharing options...
John Edwards 2 Posted May 11, 2021 Author Share Posted May 11, 2021 Oh wow. I was just about to write JavaScript and load it that way. Youre saying I can put an amper-variable into the default value field . . . wouldnt have guessed that would work. This unit is called from an MRE stub, so I can just put it there. Thanks for the tip. Link to comment Share on other sites More sharing options...
David Beagan Posted May 11, 2021 Share Posted May 11, 2021 You are welcome. Just to be clear, it needs to be a global amper variable (two ampersands). Link to comment Share on other sites More sharing options...
John Edwards 2 Posted May 11, 2021 Author Share Posted May 11, 2021 This didnt work. Is there a trick Im missing I got the literal value &&FOURTEEN_DAYS_AGO in the field instead of it resolving. Link to comment Share on other sites More sharing options...
David Beagan Posted May 11, 2021 Share Posted May 11, 2021 Your screenshot is from App Studio HTML Canvas, not Designer. Let me see what I can come up with. Link to comment Share on other sites More sharing options...
John Edwards 2 Posted May 11, 2021 Author Share Posted May 11, 2021 Thanks anyway, but I wrote JavaScript. Its done. I just load straight into the innerHTML. Generally a roll my own for UI, so I cant keep up with the difference between Canvas and Designer. Last I knew it was Composer. IB likes to change the name of things every year, heres hoping Tibco puts an end to that bad habit. Link to comment Share on other sites More sharing options...
David Beagan Posted May 11, 2021 Share Posted May 11, 2021 Your .htm file created in HTML Canvas will need to be called from a fex using the -HTMLFORM command. (You will call this fex instead of the .htm file.) For example if your .htm was named days_ago.htm then the fex would have: -SET &FOURTEEN_DAYS_AGO = EDIT(DATECVT(DTADD('&DATEMTBDBYY', DAY, -14) , 'MDYY' , 'A8MDYY'), '99/99/9999'); -HTMLFORM IBFS:/WFC/Repository/Public/days_ago.htm In the .htm you reference the variable as !IBI.AMP.FOURTEEN_DAYS_AGO; I tested this in 8.2.06: Link to comment Share on other sites More sharing options...
John Edwards 2 Posted May 12, 2021 Author Share Posted May 12, 2021 Oh man, I should have thought of that. I use !ibi references all over the place, should have twigged on to needing to do that in this setting as well. Ill give that a shot just to prove the concept, but I have the js code in production already. Thanks for the tutorial. If myibi is anything like Focal Point, Ill be searching for a solution to this same problem five years from now. Ill be sure to thank you again when that happens. Link to comment Share on other sites More sharing options...
Douglas Lee 2 Posted May 17, 2021 Share Posted May 17, 2021 That all sounds good However, can the Default for a Calendar control be set entirely from within Designer 8207 Case in point: An Old File is used as a source which only has data, and date fields, for 2014-2016. The report Filter is set for the Date Selected from the Calendar. The report is Sorted by Highest 7 dates. The Calendar Control needs to have its Default set to Dec 31 2016, not the current date. ** Or, set to the MAX Date in the Source File. 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