Increment the date by using date token passed as input
When we select a date as input from the multiselect, it should populate the next date/previous date with the date which I gave as input..
For example: If I select 11/1/2018 as my input, the result should be (11/1/2018 and 11/2/2018) or (10/31/2018 and 11/1/2018) and this result needs to be passed as an input to my panel using token..
Can anyone help me figure out how to do this?!
Thanks in Advance!!
@sarahnazzar,
You can fnd the relative time on the change event and assign to a token.
<change>
<eval token="before">relative_time(strptime($date$,"%m/%d/%Y"),"-1d@d")</eval>
<eval token="after">relative_time(strptime($value$,"%m/%d/%Y"),"1d@d")</eval>
</change>
See below a run anywhere example
<form >
<label>Date Conversion</label>
<fieldset submitButton="false">
<input type="dropdown" token="date">
<label>Date</label>
<choice value="11/01/2018">11/01/2018</choice>
<choice value="10/31/2018">10/31/2018</choice>
<change>
<eval token="before">strftime(relative_time(strptime($date$,"%m/%d/%Y"),"-1d@d"),"%d-%m-%Y")</eval>
<eval token="after">strftime(relative_time(strptime($value$,"%m/%d/%Y"),"1d@d"),"%d-%m-%Y")</eval>
</change>
</input>
</fieldset>
<row>
<panel>
<html>
<h1> $before$ | $after$</h1>
</html>
</panel>
</row>
</form>
@sarahnazzar,
You can fnd the relative time on the change event and assign to a token.
<change>
<eval token="before">relative_time(strptime($date$,"%m/%d/%Y"),"-1d@d")</eval>
<eval token="after">relative_time(strptime($value$,"%m/%d/%Y"),"1d@d")</eval>
</change>
See below a run anywhere example
<form >
<label>Date Conversion</label>
<fieldset submitButton="false">
<input type="dropdown" token="date">
<label>Date</label>
<choice value="11/01/2018">11/01/2018</choice>
<choice value="10/31/2018">10/31/2018</choice>
<change>
<eval token="before">strftime(relative_time(strptime($date$,"%m/%d/%Y"),"-1d@d"),"%d-%m-%Y")</eval>
<eval token="after">strftime(relative_time(strptime($value$,"%m/%d/%Y"),"1d@d"),"%d-%m-%Y")</eval>
</change>
</input>
</fieldset>
<row>
<panel>
<html>
<h1> $before$ | $after$</h1>
</html>
</panel>
</row>
</form>
Thanks a lot!! The above solution is working fine.