Jump to content

Spotfire Dropdown list -Fixed Value for multiple values problem


Iain
Go to solution Solved by David Boot-Olazabal,

Recommended Posts

I am currently making Spotfire where I am filtering my data using a dropdown list with fixed values, the fixed values are currently "All", "Option 1", "Option 2" and the one I am struggling to syntax correctly when filtering my data is option 3 which is "Option 1 & Option 2" where i am i going wrong? code below bold is the section i am struggling to syntax correctly

 

And case when DocumentProperty("Model") = "ALL" THEN [Model]=[Model] WHEN DocumentProperty("Model") = "option 3" THEN [Model]= "option1" &"option2"  ELSE [Model]= DocumentProperty("Model")END

Link to comment
Share on other sites

Hi Iain,

For my understanding, you're trying to combine the option 1 and option 2 values, when the dropdown list is filtered to option 3?
And you're struggling to get the combination of option 1 and option 2 into the fixed values of the dropdown list. Is that correct?

If so, do you get an error message (you can't save the dropdown list property? Or does it display the value erroneously? Could you share perhaps your dxp file or some screenshots that makes your use case more clear? Because I can't figure out if you just need a concatenate function in the CASE statement (instead of "option 1"&"option2") or that you would need a different approach.

Kind regards,

David

Link to comment
Share on other sites

Posted (edited)

Hi David 

 

i have a column called engine Model with "1litre", "2litre" and individual parts which i don't want to include,

the dropdown works successfully and is passing a value correctly, but when i use the document property to filter my visualizations it does not filter correctly, 

image.png.c4345600af470e874050623893360d92.png

 

this is my code, "ALL" works correctly, and also after else. 

 

the problem is implementing the middle part from the second WHEN to before ELSE

Edited by Iain
Link to comment
Share on other sites

Hi Iain,

What does your Document property holds as values (the values from the dropdown)?
Are these: ALL, Engine and 'the other parts'?
And what values does the [Engine Model] column hold? I assume 1litre and 2litre are different values. Is that correct?

If so, I think the '&' between "1litre" & "2litre" will be the problem. You could try to concatenate them, into a single string: concatenate("1litre","2litre").

Kind regards,

David

Link to comment
Share on other sites

Hi David

 

i have tried the concatenate as discussed and it is not giving any results,

yes the values in the column are "1litre", "2Litre" and then individual items such as "200cc", "400cc"... 

therefore the dropdown i have got passed a value for "Engine", which i am then filtering in my visualizations shown in the picture attached previously

ideally i the concatenate would work and the Engine selection in the dropdown would then pass the "Engine" document property filtering the visuals to only include entries with "1litre", "2litre".

I'm assuming that concatenating this as concatenate("1litre","2litre") is then looking to filter for "1litre2litre" rather than "1litre" & "2litre" individually, thus no data is being filtered and the visuals blank at the moment. 

hope this provides a better explanation of my problem

 

thanks 

iain

Link to comment
Share on other sites

image.png.1b399d9a67986b1a280a540b44e00b8c.pngthis is what I have got in the dropdown

when the value "engine" is passed i use that within the visualization to try filter for the 1 and 2 litre from my previous screenshot

image.png.59e82725d1a2a0db13f3d5dae0ac2d08.pngthis is my column structure, i am essentially wanting the 1 dropdown option that passes Engine to filter for the "1litre" and "2litre" only. 

 

Link to comment
Share on other sites

  • Solution

Hi Iain,

I think I got it.
I've created a simple data table, with 4 columns. I've added a dropdown list property, as per the below:
image.png.32f93e697a96876d66884a91880199b1.png

Based upon the selection of the values of the drop down, a Filter column displays if it is true or not. The Filter column is the CASE statement. This is the view for the 1litre selection:

image.png.575ddc6b4e380b60c9d9585339aa3e5a.png

Now, because I have altered your initial CASE statement, the view from the 1litre&2litre selection 'collects' both the 1litre and 2litre engines:

image.png.0c425046f023fbc86cd8018b19a671df.png

And then you can tie the Filter column to your way of filtering out the data.

The CASE statement I used to combine both 1litre and 2litre engines, is this one:
case  when DocumentProperty("EngineModel")="All" THEN [Engine Model]=[Engine Model]
WHEN DocumentProperty("EngineModel")="1 litre" THEN [Engine Model]="1litre"
WHEN DocumentProperty("EngineModel")="2 litre" THEN [Engine Model]="2litre"
WHEN DocumentProperty("EngineModel")="Engine" THEN ([Engine Model]="1litre") or ([Engine Model]="2litre")
ELSE [Engine Model]=DocumentProperty("EngineModel") END

Kind regards,

David

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...