Hi All,
I need to display dynamic value in the panel title. The dynamic value needs to come from the time range label.
I have a custom time picker whose partial code snippet is below...
<form>
<label>Demand Billed Dashboard-DBQuery Clone</label>
<fieldset submitButton="false" autoRun="true">
<input type="dropdown" token="field1" searchWhenChanged="true">
<label>Select Time Range</label>
<choice value="1">1 day ago</choice>
<choice value="2">2 days ago</choice>
<default>1</default>
</input>
</fieldset>
<row>
<panel>
<table>
<title>Demand Billed - $field1$</title>
In the title tag with the '$field1$' i am able to display the value [1 or 2 depending upon what is selected as time range].
How can we display the text "1 day ago" corresponding to value="1" , i want to get the text and display it based on the time range selection instead of the value.
Please guide me.
Requirement ---> title should be displayed as
Demand Billed - 1 day ago
Demand Billed - 2 days ago
we can achieve this using Javascript. where we can capture dropdown label and render it in token in panel header.
This is now possible to do in SimpleXML.
Modify your input, and add a change action
<default>1</default>
<change>
<set token="display">$label$</set>
</change>
The change your panel title to use the new token
<title>Demand Billed - $display$</title>
While this works perfectly for any number within last 24 hours but when I change time to 7 days or something else, title shows the "...in the Custom time"
Any fix for this ?
This worked for me with time pickers. It is not pretty while it waits for data to load but once it gets the field1 values it works.
Next I want to play with the time format.
$field1.earliest$ to $field1.latest$
So, I use that at the end of my title.
we can achieve this using Javascript. where we can capture dropdown label and render it in token in panel header.
thanks Nawneel!
Hi All,
Any other pointers as to how this can be achieved. Thanks.
Hi nekbote
It is simple
form>
<label>Demand Billed Dashboard-DBQuery Clone</label>
<fieldset submitButton="false" autoRun="true">
<input type="time" searchWhenChanged="true">
<label>Select a time:</label>
<default>Last 24 hours</default>
</input>
</fieldset>
<row>
<panel>
<table>
<title>Demand Billed Demand Billed there are $earliest$</title>
You can also use the following
<title>Demand Billed Demand Billed between $earliest$ and $latest$</title>
where :
-1d@d represent 1 day ago
-2d@d represent 2 day ago
Hi Chimell,
Thanks for the suggestion but it does not work in my case.
Mine is custom time picker which provides 1-14 day time selection [earliest and latest alone does not work]. I want to display the the label corresponding to the time picker value. in your suggestion , i want to display the value 1 day ago as label and not -1d@d.
<form>
<label>Demand Billed Dashboard-DBQuery Clone</label>
<fieldset submitButton="false" autoRun="true">
<input type="dropdown" token="field1" searchWhenChanged="true">
<label>Select Time Range</label>
<choice value="1">1 day ago</choice>
<choice value="2">2 days ago</choice>
<choice value="3">3 days ago</choice>
<choice value="4">4 days ago</choice>
<choice value="5">5 days ago</choice>
<choice value="6">6 days ago</choice>
<choice value="7">7 days ago</choice>
<choice value="8">8 days ago</choice>
<choice value="9">9 days ago</choice>
<default>1</default>
</input>
</fieldset>
<row>
<panel>
<table>
<title>Demand Billed - $field1$</title>
hi,
try like this
<form>
<label>Demand Billed Dashboard-DBQuery Clone</label>
<fieldset submitButton="false" autoRun="true">
<input type="dropdown" token="field1" searchWhenChanged="true">
<label>Select Time Range</label>
<choice value="1 day ago">1 day ago</choice>
<choice value="2 days ago">2 days ago</choice>
<default>1 day ago</default>
</input>
</fieldset>
<row>
<panel>
<table>
<title>Demand Billed - $field1$</title>
OR
<form>
<label>Demand Billed Dashboard-DBQuery Clone</label>
<fieldset submitButton="false" autoRun="true">
<input type="dropdown" token="field1" searchWhenChanged="true">
<label>Select Time Range</label>
<choice value="1 day ago"> 1 </choice>
<choice value="2 days ago"> 2 </choice>
<default>1 day ago</default>
</input>
</fieldset>
<row>
<panel>
<table>
<title>Demand Billed - $field1$</title>
because $field1$ don't take the label
but take the value
please forgive my english.
Thanks gyslainlatsa for the information. But i dont think this solution works and the reason being in my search query i still need to use the token $field1$ and your suggested solution will not work.
My searc hquery makes use of the token in the below date condition.
VARCHAR_FORMAT(CURRENT TIMESTAMP - $field1$ day, 'YYYYMMDD')
Do you have any other suggestion of getting around it.
Also just an addition , yes i understand $field1$ takes value and not label and i am requesting how to get the label.