Dashboards & Visualizations

How do you search with value and changed value?

patsta_g
Engager

I have a form with a text field (strfield1), values like '98.12.123456.12345678'.

I need to search with the value of this field (strfield1) and a second value of this field without points ('980012345612345678')

Where/How in the XML can i create a string like:
strfield1b = replace($strfield1$,".","")
so I can search like
index=x AND (Identcode=$strfield1$ OR Identcode=$strfield1b$

0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

@patsta_g ,

Try

    <input type="text" token="strfield1">
      <label>Identcode</label>
      <change>
        <eval token="strfield1b">replace($value$,"\\.","")</eval>
      </change>
    </input>
Happy Splunking!

View solution in original post

renjith_nair
SplunkTrust
SplunkTrust

@patsta_g ,

Try

    <input type="text" token="strfield1">
      <label>Identcode</label>
      <change>
        <eval token="strfield1b">replace($value$,"\\.","")</eval>
      </change>
    </input>
Happy Splunking!

patsta_g
Engager

I added "\" - and the everything is fine! 🙂
thanks a lot!

0 Karma

p_gurav
Champion

Hi patsta_g,

You can use token, Please check below code I tested with some sample values:

<form>
  <label>test_text_filter</label>
  <fieldset submitButton="true" autoRun="false">
    <input type="text" token="field1" searchWhenChanged="true">
      <label>Text</label>
      <change>
        <eval token="abc">replace($field1$,"-","")</eval>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults | eval host="ip-1-2-3-4,test-interview,testinterview" | makemv delim="," host| mvexpand host | search host=$field1$ OR host="$abc$"</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</form>
0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk Cloud Platform 9.1.2308?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2308! Analysts can ...

Index This | Why do they call it hyper text?

November 2023 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

State of Splunk Careers 2023: Career Resilience and the Continued Value of Splunk

For the past three years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...