Dashboards & Visualizations

Why are values for a dynamic checkbox not being populated by variables passed from 2 drop-downs?

vdevarayan
Path Finder

I have a top level form with two drop-downs - say Department & Employee
Department drop-down has unique dept names. Once a dept is selected, all employees in that dept get populated in the second drop-down. The values of the selected drop-down are available in $dept$ and $empname$

So far, so good.

Now, I have a panel in the dashboard that uses the above variables ($dept$, $empName)

The problem i am having is that the $dept$, $empName$ is NOT getting substituted inside the form with checkbox.

Here is my source code:

<panel>
  <input type="checkbox" token="cbstring" searchWhenChanged="true">
    <choice value="source=/shome/dept-emp.txt deptName=$dept$ empName=$empName$ | timechart max(somecol) ">Max</choice>
    <choice value="source=/shome/dept-emp.txt deptName=$dept$ empName=$empName$ | timechart max(somecol) ">Avg</choice>
    <choice value="source=/shome/dept-emp.txt deptName=$dept$ empName=$empName$ | timechart max(somecol) ">Min</choice>
    <prefix> |</prefix>
    <suffix> </suffix>
    <!-- Each value will be surrounded by the valuePrefix and valueSuffix -->
    <valuePrefix> appendcols [search </valuePrefix>
    <valueSuffix> ] </valueSuffix>
    <!-- All the values and their valuePrefix and valueSuffix will be concatenated together with the delimiter between them -->
    <delimiter> | </delimiter>
  </input>
  <chart>
        <searchString>"source=/shome/dept-emp.txt deptName=$dept$ empName=$empName$ | timechart max(somecol) " $cbstring$</searchString>
  </chart>
</panel>

Search does not return any results as it is trying to search for "$dept$" instead of the substituted values.
I tried with $$dept$$, '$dept$' - nothing worked.

Any suggestions?

1 Solution

vdevarayan
Path Finder

Figured it out.
Solution is to keep the variables $dept$ outside of the choice tag and use prefix. That worked

View solution in original post

0 Karma

vdevarayan
Path Finder

Figured it out.
Solution is to keep the variables $dept$ outside of the choice tag and use prefix. That worked

0 Karma

adeelzafar
Engager

Hi vdevaryan.. I have exactly same issue... Can you please provide more details on how you resolved it?

I mean can you please share your code of using prefix for $dept$..

Thanks a lot buddy.

0 Karma

vdevarayan
Path Finder

Followup to the above question:
I followed the documentation from
http://docs.splunk.com/Documentation/Splunk/6.2.2/Viz/PanelreferenceforSimplifiedXML

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...