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
Legend

@patsta_g ,

Try

    <input type="text" token="strfield1">
      <label>Identcode</label>
      <change>
        <eval token="strfield1b">replace($value$,"\\.","")</eval>
      </change>
    </input>
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

@patsta_g ,

Try

    <input type="text" token="strfield1">
      <label>Identcode</label>
      <change>
        <eval token="strfield1b">replace($value$,"\\.","")</eval>
      </change>
    </input>
---
What goes around comes around. If it helps, hit it with Karma 🙂

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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...