I have a time picker & a time dropdown which has static values.
<panel id="pqr">
<input type="time" token="time">
<label>DateTime</label>
<default>
<earliest>@d</earliest>
<latest>now</latest>
</default>
</input>
</panel>
<panel id="abc">
<input type="dropdown" token="timedrop">
<label>Time Dropdown</label>
<choice value="now">Now</choice>
<choice value="+3d">3d</choice>
<choice value="+4d">4d</choice>
<choice value="+5d">5d</choice>
<default>now</default>
<change>
<eval token="latest_Time">if('timedrop'="now",now(),relative_time(if($time.latest$="now",now(),$time.latest$), $timedrop$))</eval>
</change>
</input>
</panel>
The expectation is if Now is selected in timedrop, the data till now should load. If +3d is selected in timedrop, then +3d should be added with the time.latest token (coming from the time picker) and so on.
On load (by default Today is selected), the latest_Time is returning NAN, but if I select a specific time range (say 8th April 10AM-11AM) & timedrop as 3d, it is working as expected.
Try like this:
<panel id="pqr">
<input type="time" token="time">
<label>DateTime</label>
<default>
<earliest>@d</earliest>
<latest>now</latest>
</default>
</input>
</panel>
<panel id="abc">
<title>Latest time token $latest_Time$</title>
<input type="dropdown" token="timedrop">
<label>Time Dropdown</label>
<choice value="now">Now</choice>
<choice value="+3d">3d</choice>
<choice value="+4d">4d</choice>
<choice value="+5d">5d</choice>
<default>now</default>
<change>
<eval token="latest_Time">if(isnull('timedrop') or 'timedrop'="now",now(),relative_time(if($time.latest$="now",now(),$time.latest$), $timedrop$))</eval>
</change>
</input>
</panel>
There doesn't seem to be a way to set an initial value on a time input - perhaps this is a bug?
Try like this:
<panel id="pqr">
<input type="time" token="time">
<label>DateTime</label>
<default>
<earliest>@d</earliest>
<latest>now</latest>
</default>
</input>
</panel>
<panel id="abc">
<title>Latest time token $latest_Time$</title>
<input type="dropdown" token="timedrop">
<label>Time Dropdown</label>
<choice value="now">Now</choice>
<choice value="+3d">3d</choice>
<choice value="+4d">4d</choice>
<choice value="+5d">5d</choice>
<default>now</default>
<change>
<eval token="latest_Time">if(isnull('timedrop') or 'timedrop'="now",now(),relative_time(if($time.latest$="now",now(),$time.latest$), $timedrop$))</eval>
</change>
</input>
</panel>
There doesn't seem to be a way to set an initial value on a time input - perhaps this is a bug?
Tried this method but for some reason I still see the same error.
All you have shown is a screen grab of something that isn't working without any detail of what you have actually tried i.e. the SimpleXML you are using in this instance. Please share some useful information.
I've already given all the details & mentioned earlier that I used your method. To be specific, I used this below mentioned statement in the "timedrop" dropdown change section.
But still getting Nan error
<panel id="pqr">
<input type="time" token="time">
<label>DateTime</label>
<default>
<earliest>@d</earliest>
<latest>now</latest>
</default>
</input>
</panel>
<panel id="abc">
<input type="dropdown" token="timedrop">
<label>Time Dropdown</label>
<choice value="now">Now</choice>
<choice value="+3d">3d</choice>
<choice value="+4d">4d</choice>
<choice value="+5d">5d</choice>
<default>now</default>
<change>
<eval token="latest_Time">if(isnull('timedrop') or 'timedrop'="now",now(),relative_time(if($time.latest$="now",now(),$time.latest$), $timedrop$))</eval></change>
</input>
</panel>
@ITWhisperer I've removed the option Now from the dropdown, what should be the new eval statement instead of
<eval token="latest_Time">if(isnull('timedrop') or 'timedrop'="now",now(),relative_time(if($time.latest$="now",now(),$time.latest$), $timedrop$))</eval>
?
Except that the screen grab you showed is not from this SimpleXML code