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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...