I have a hidden search. When I have a result I want to set the token based on that result, otherwise if I don't have any results I want to set the token to *. However, this does not work for me yet (the no results part with setting the token to all).
<search id="latest_product_id">
<query>
| mysearch
| head 1
| fields product_id
</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
<refresh>60</refresh>
<depends>
<condition token="some_token">*</condition>
</depends>
<done>
<condition match="'job.resultCount'!= 0">
<set token="latest_product_id">$result.product_id$</set>
</condition>
<condition match="'job.resultCount'== 0">
<set token="latest_product_id">*</set>
</condition>
</done>
</search>
Where is "all" coming from? It is not shown in your source listing. Also, the depends block you have shown is not part of valid SimpleXML. How are you using the latest_product_id token?
I updated the search:
<search depends="some_other_token">
<query>
| mysearch id in $some_other_token$
| head 1
| fields product_id
</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
<refresh>60</refresh>
<done>
<condition match="'job.resultCount'!= 0">
<set token="form.some_token">$result.product_id$</set>
</condition>
<condition match="'job.resultCount'== 0">
<set token="form.some_token">*</set>
</condition>
</done>
</search>
The all is an option in the following multiselect
<input id="select_abc" type="multiselect" token="some_token" searchWhenChanged="true">
<default>*</default>
<prefix>(</prefix>
<suffix>)</suffix>
<valuePrefix>"</valuePrefix>
<valueSuffix>"</valueSuffix>
<choice value="*">All</choice>
<search base="base_search">
<query>
| search to fill dropdown options
| fields label, product_id
</query>
</search>
<fieldForLabel>label</fieldForLabel>
<fieldForValue>product_id</fieldForValue>
<delimiter>,</delimiter>
</input>
So I want to set the value of the above multiselect (seom_token) on init and when another dropdown (some_other_token) changed. some_other_token is used in the search above.