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
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...