Dashboards & Visualizations

How can pass the label name to the simpleresults header module ?

rakesh_498115
Motivator

Hi ..

I have a form with dropdown control as below.

<input type="dropdown" token="operator1" searchWhenChanged="true">
            <label>Select ItemId</label>
            <default>*</default>
            <choice value="*">All</choice>
            <choice value="23">ItemId1</choice>
            <choice value="33">ItemId2</choice>
            <choice value="43">ItemId3</choice>
        </input>

Now in query i am passing $operator1$ and getting the value associated with it . ie *,23,33 and 43 etc.

Now my question , i have a simpleheader module to show the heading , now in head instead of the showing the value , i wanted to show the label name

i.e All,ItemId1,ItemId2,ItemId3 etc.... i tried $operator1.name$ but this didnt work ?? is there any way to get the label name then the value ??

Thanks in advance.

my sample code , where i am using to print the selected label name instead of value. which is not working.

<fieldset autoRun="true" submitButton="false">
        <input type="dropdown" token="operator1" searchWhenChanged="true">
            <label>Select Operator (All):</label>
            <default>*</default>
            <choice value="*">All</choice>
            <choice value="*">ItemId1</choice>
            <choice value="*">ItemId2</choice>
            <choice value="*">ItemId3</choice>
        </input>



    </fieldset>
    <row>
        <html>
            <h2> Report Generated for Operator Name  : <b> $operator1.name$ </b>
            </h2>

        </html>
    </row>
    <row>
Tags (2)
0 Karma

splunker12er
Motivator

Cool. You can use lookups,

Create a csv file like below - place it under :- /opt/splunk/etc/app-name/lookups/itemlookup.csv

ItemId,Values
Itemid1,22
Itemid1,23
..
..

create below configs under /local

props.conf

[Itemlookup]
Lookup-itemlookup = Itemlookup itemid as Itemid OUTPUTNEW Values

transforms.conf

[Itemlookup]
filename = Itemlookup.csv

Search query:

[your search]| lookup Itemlookup Itemid as itemid| fields Values

Appropriatly , pass the Itemid and internally it will get you the values/....

have fun

0 Karma

splunker12er
Motivator

But , whats the use of showing the label name inside the dropdown list ? You can show the label name beside the dropdown list. But not inside the values of drop down.

on selecting that particular label name , it will be passed as an argument for your further search , but where that search will not contain any actual data for it.

But , still if you need to get the label name inside the dropdown values , use static fields

eg :
advanced xml.

<param name="staticFieldsToDisplay">
         <list>
            <param name="value">operator1.name</param>
          </list>
</param>
0 Karma

rakesh_498115
Motivator

Hi Splunker12er. i guess you got my requiremnt wrong. i dont want the label namevalue inside the dropdown list. If you see my code above i am able to create a drop down with the following data i.e All as "", ItemId1 as "23" ,ItemId2 as "33" and ItemId3 as "43" . Here All,ItemId1,ItemId2 and ItemId3 are the Label names which i show to user , and internal i pass the values associated to it . ie. 23,33,43 or "" . now my problem is i have a html module to show the heading the user something you selected so and so item. to give this heading i need the above requirement.

0 Karma

rakesh_498115
Motivator

any work around on this ??

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...