First time when dashboard is loading change condition is detected and correct part is replaced in Web Request Panel. When i change the value in drop down, Change condition is not getting recognized and query in panel is like below
"cart | timechart count"
<form>
<label>Test</label>
<fieldset submitButton="false" autoRun="true">
<input type="time" token="timePicker">
<label />
<default>
<earliest>-4h@m</earliest>
<latest>now</latest>
</default>
</input>
<input type="dropdown" token="serviceName">
<label>Service</label>
<choice value="">Select a Service</choice>
<choice value="lpd">LPD</choice>
<choice value="cart">Cart</choice>
<choice value="identity">Identity</choice>
<default>Select a Service</default>
<initialValue>Select a Service</initialValue>
<change>
<condition value="lpd">
<set token="serviceName">index=test1</set>
</condition>
<condition value="cart">
<set token="serviceName">index=test2</set>
</condition>
<condition value="identity">
<set token="serviceName">index=test3</set>
</condition>
</change>
</input>
<input type="radio" token="byHost" searchWhenChanged="true">
<label>By Host</label>
<choice value="by host">Yes</choice>
<choice value="">No</choice>
<default>by host</default>
<initialValue>by host</initialValue>
</input>
</fieldset>
<row>
<panel>
<title>Web Request</title>
<chart>
<search>
<query>$serviceName$ | timechart count</query>
<earliest>$timePicker.earliest$</earliest>
<latest>$timePicker.latest$</latest>
</search>
<option name="charting.chart">line</option>
</chart>
</panel>
</row>
</form>
You have token contention for the serviceName token which is what is causing your issue. You are using change to set the token that you are also using as the token for the drop down selector. You need to make a choice on how you want the token to be populated, either have the drop down selections populate serviceName or the change event on the input. The quickest fix is to just assign a different token to the drop down selector:
<form>
<label>Test</label>
<fieldset submitButton="false" autoRun="true">
<input type="time" token="timePicker">
<label></label>
<default>
<earliest>-4h@m</earliest>
<latest>now</latest>
</default>
</input>
<input type="dropdown" token="serviceNamedropdown">
<label>Service</label>
<choice value="">Select a Service</choice>
<choice value="lpd">LPD</choice>
<choice value="cart">Cart</choice>
<choice value="identity">Identity</choice>
<default>Select a Service</default>
<initialValue>Select a Service</initialValue>
<change>
<condition value="lpd">
<set token="serviceName">index=test1</set>
</condition>
<condition value="cart">
<set token="serviceName">index=test2</set>
</condition>
<condition value="identity">
<set token="serviceName">index=test3</set>
</condition>
</change>
</input>
<input type="radio" token="byHost" searchWhenChanged="true">
<label>By Host</label>
<choice value="by host">Yes</choice>
<choice value="">No</choice>
<default>by host</default>
<initialValue>by host</initialValue>
</input>
</fieldset>
<row>
<panel>
<title>Web Request</title>
<chart>
<search>
<query>$serviceName$ | timechart count</query>
<earliest>$timePicker.earliest$</earliest>
<latest>$timePicker.latest$</latest>
</search>
<option name="charting.chart">line</option>
</chart>
</panel>
</row>
</form>
@Chiddarthan you would also need to enable searchWhenChanged="true" for the dropdown
<input type="dropdown" token="serviceNamedropdown" searchWhenChanged="true">
Rest all code remains the same as you originally posted.