Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Formatting display value for Dynamic Filter Parameter
lgudait
Hi,
I'm designing a report using dynamic filter parameters. I would like to include the parameter values in an end note so the user knows what values they selected if they decide to print/pdf the report.
The issue I'm having is that the params["parameterName"].value function provides very technical results that my not very savvy clients will understand. Is there any way to "translate" the values so that the parameter results look like normal English, instead of tech-speak? I can't think of anything - since the operator changes, it's hard to parse the values into pieces that I could engineer.
A few examples (with multiple types of operators):
Data Element: if(params["param_Disease"].value=="") {"All Diseases"} else("Diseases restricted to: "+params["param_Disease"].value)
Result: Diseases restricted to: ([DISEASE] = "Disease1")
Desired Result: Diseases restricted to: Disease1
Data Element: if(params["param_State"].value=="") {"All States"} else("States restricted to: "+params["param_State"].value)
Result: States restricted to: IN([STATE],"IL","IN")
Desired Result: States restricted to: "IL","IN"
Data Element: if(params["param_Date"].value=="") {"All Periods"} else("Date restricted to: "+params["param_Date"].value)
Result: Date restricted to: BETWEEN([DATE_FIELD],"2000-01-01 00:00:00.000-0500","2012-07-24 00:00:00.000-0400")
Desired Result: Date restricted to: between 1/1/2000 and 7/24/2012
Find more posts tagged with
Comments
mwilliams
You'll probably have to use a script to transform the text how you want it to look.
lgudait
OK, so I finally just came back to this...<br />
I'm sure there's a more elegant way to do these, but here's what I came up with:<br />
<br />
For dynamic filters using IN and EQUAL TO:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>params["param_Disease"].value.substring(params["param_Disease"].value.indexOf('"'),(params["param_Disease"].value.lastIndexOf('"')+1)))
</pre>
^This includes all text between the first and last double quotes<br />
<br />
For dynamic filters using dates >= or <=<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>params["param_Date"].value.substr(params["param_Date"].value.indexOf('"')+1,10)</pre>
^This locates the start of the date, and takes the next 10 characters to get the full date<br />
<br />
For dynamic filters using BETWEEN:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>"Date is between "+params["param_Date"].value.substr(params["param_Date"].value.indexOf('"')+1,10)
+" and "
+params["param_Date"].value.substr(params["param_Date"].value.lastIndexOf(',')+2,10))</pre>
^This locates the first date the same way as >=/<=, and finds the second date using the comma
mwilliams
On the ones I converted, I think I had fairly similar script to you. Been long enough, now, that I don't remember exactly. Thanks for the update! If I find a more elegant solution to the issue, I'll let you know. You could always file an issue with this, with support, to have a "prettier" display text, out of the box, for future versions.