Jump to content

Im looking to have a calendar field default to 14 days ago....


John Edwards 2

Recommended Posts

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

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

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

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...