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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...