Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Just trying to create a drop down where I can select a few different date ranges such as last 7 days, last 14 days etc.
Currently I can create a button and set the Field to "Date" and set the value to
='<' & Date(Today()) & '>=' & Date(Today()- 7)
which will select me the last 7 days from todays date. Although I want to somehow convert this into some type of drop down where i can have a few different selections to pick from.
Im trying to now use the Variable extension where I can set fixed values (of the same code I had before) which looks like this, but once I switch from one selection to another, the date doesn't get selected.
I do have to select/create a variable which I have just created an empty one called "zdate" that doesnt contain anything inside which might be where I am going wrong as I'm not quite sure what to put in here to make it work.
Is anyone able to help me with this or let me know an alternative option?
I've had a look as the developer extensions users have created although there isn't anywhere I can customize the dates I want to show.
Thanks
You can create Rules like this:
CalRules:
LOAD * INLINE [
Name, Rule1, Rule2
Today, =Today()
Yesterday, "=Today()-1"
Last 7 Days, ">=Today()-7"
Last 10 Days, ">=Today()-10"
Last 14 Days, ">=Today()-14"
Last 30 Days, ">=Today()-30"
This Week, ">=WeekStart(Today())"
Last Week, ">=WeekStart(Today(),-1)", "<=WeekEnd(Today(),-1)"
Last Two Weeks, ">=WeekStart(Today(),-2)", "<=WeekEnd(Today(),-2)"
This Month, ">=MonthStart(Today())"
Last Month, ">=MonthStart(Today(),-1)", "<=MonthEnd(Today(),-1)"
Last Two Months, ">=MonthStart(Today(),-2)", "<=MonthEnd(Today(),-2)"
This Year, ">=YearStart(Today())"
Last Year, ">=YearStart(Today(),-1)", "<=YearEnd(Today(),-1)"
];
tab1:
LOAD Date(Today()-IterNo()+1) As tranDate
AutoGenerate 1
While IterNo() <=135
;
Left Join(tab1)
LOAD *
Resident CalRules;
tab2:
LOAD *, Evaluate(Chr(39)&tranDate&Chr(39)&Rule1&If(Not IsNull(Rule2),' And '&Chr(39)&tranDate&Chr(39)&Rule2)) As Eval,
Chr(39)&tranDate&Chr(39)&Rule1&If(Not IsNull(Rule2),' And '&Chr(39)&tranDate&Chr(39)&Rule2) As Str
Resident tab1;
tab3:
NoConcatenate
LOAD *
Resident tab2
Where Eval;
Drop Table CalRules, tab1, tab2;