All Apps and Add-ons

Using $foo$ to link views together in HTML module

ahall_splunk
Splunk Employee
Splunk Employee

I am trying to combine a Pulldown with a HTML module to link to another module. Here is the code:

    <module name="TextField" layoutPanel="panel_row1_col1_grp1" autoRun="True">
        <param name="name">database</param>
        <param name="width">400px</param>
        <param name="label">Database Name: </param>

        <module name="HTML" layoutPanel="panel_row1_col1_grp1" autoRun="True">
            <param name="html"><![CDATA[<p>Information about this database is also available in the <a href="other_dashboard?database=$database$">Other Dashboard</a> page.</p>]]></param>
        </module>

Unfortunately, the $database$ is not represented properly when rendering, causing the wrong selection in the other dashboard. Specifical a single back-slash is replaced by a double back-slash, so WIN-SERVER\database becomes WIN-SERVER\\database.

How can I fix this?

1 Solution

sideview
SplunkTrust
SplunkTrust

When you're using a key in a Search or PostProcess module, you will want to use $database$, and backslashes in the value will automatically get escaped as you see.

However, when you're specifying a key for the Redirector module, putting a key directly in an anchor tag like this within an HTML module, or in any way specifying something that ends up in a URL, you always want to use the "rawValue" version instead -- in this case $database.rawValue$.

This is covered in the Sideview Utils documentation, and in a little more detail than I'm giving here. Within the app menu, go to

"key techniques > linking views together"

There are several pages in there and note that on the second page the notes talk about the importance of $foo$ vs $foo.rawValue$ and how this relates to backslash-escaping.

Also, to anyone else reading, if you've only read the reference documentation in /en-US/modules, make sure to go back and read through the actual documentation in the app itself because there is a lot of important information there, so much that important details are fairly easy to miss the first time through.

Hope this helps.

View solution in original post

0 Karma

sideview
SplunkTrust
SplunkTrust

When you're using a key in a Search or PostProcess module, you will want to use $database$, and backslashes in the value will automatically get escaped as you see.

However, when you're specifying a key for the Redirector module, putting a key directly in an anchor tag like this within an HTML module, or in any way specifying something that ends up in a URL, you always want to use the "rawValue" version instead -- in this case $database.rawValue$.

This is covered in the Sideview Utils documentation, and in a little more detail than I'm giving here. Within the app menu, go to

"key techniques > linking views together"

There are several pages in there and note that on the second page the notes talk about the importance of $foo$ vs $foo.rawValue$ and how this relates to backslash-escaping.

Also, to anyone else reading, if you've only read the reference documentation in /en-US/modules, make sure to go back and read through the actual documentation in the app itself because there is a lot of important information there, so much that important details are fairly easy to miss the first time through.

Hope this helps.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...