Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I am trying to set the default for a page - I want the default date to appear in the Calendar:
I have tried setting a variable called vMyDate = Today()
I have then gone to the page and tried to get the Calendar object to display today's date and therefore the chart would update to show today's values.
I have also tried making a button and using the trigger to set the date - (I think i remember something about dates being treated as strings???)
Complication: The calendar object reflects the field Appt_DtTm (this is decimal and shows date and time). I need the date and time reflected in the chart - see graphic
=time(App_DtTm,'HH:MM')
anyhelp gratefully appreciated.
jo
Coming back to the first part of your question:
Josephine Tedesco wrote:
I am trying to set the default for a page - I want the default date to appear in the Calendar:
I have tried setting a variable called vMyDate = Today()
I have then gone to the page and tried to get the Calendar object to display today's date and therefore the chart would update to show today's values.
I have also tried making a button and using the trigger to set the date - (I think i remember something about dates being treated as strings???)
Rather than using a trigger to set the date, use a smart expression for for the variable defining the report date. Let's cal it vMaxDate for this example:
If you want one which will display the most recent date in the model, then define vMaxDate like:
Set vMaxDate = =Date(Max(Appt_Dt )); // the two = signs are not a typo
If your dates may extend to the future, and you want to default today unless something is selected:
Set vMaxDate = =Date(If(GetSelectedCount(Appt_Dt) = 0, Today(), Max(Appt_Dt));
These two expressions will return the selected date if one is selected, but will return something useful if nothing is selected.
The extra sign causes the variable to carry the evaluated value of the expression, so you can use it simply like:
Sum({<Appt_Dt = {'$(vMaxDate )'}>} Amount)
rather than
Sum({<Appt_Dt = {'$(=Date(If(GetSelectedCount(Appt_Dt) = 0, Today(), Max(Appt_Dt)))'}>} Amount)
I can see what you are doing - you are getting to the chart expression and eventually I will probably need to do this ... but I only want the date to be the dimension that causes the chart to change - and for this I want the default to be today's date.
At the moment when I choose a date from the Calendar - The chart responds how I want it to. I was hoping that there was a way of just getting the default for the sheet to be today's date. So the chart would open to today's values.
The second option in my post does just that - it defaults to Today() if nothing is selected....
Set vMaxDate = =Date(If(GetSelectedCount(Appt_Dt) = 0, Today(), Max(Appt_Dt));
so I go to Variables Overview
and add VMaxDate as a Variable
and in the Definition add
= =Date(If(GetSelectedCount(Appt_Dt) = 0, Today(), Max(Appt_Dt)))
and in the sheet definition I go to Trigger and then??