Jump to content

Document properties help: passing to display in text area and creating a new list based on selection


KHart

Recommended Posts

I feel like I'm very "close" to understanding, but as a baby user who doesn't necessarily do a lot of ironpython, I'm struggling.

I have two different things I'm trying to address.

1) I have a document property that the user can select (fixed values):

VP
Regional VP
Manager

As I have a cascading filter, I want to dynamically display above that filter the document property they selected as opposed to writing text like "please select", but instead if Regional VP is used, then I would that to be my header above the filter. It seems that there may be a way to do this in javascript perhaps? 

2) I want to create a "new" list for the user. This list doesn't exactly exist but would be dependent on the value in the document property referenced above. If I am VP, in this list I want to have the following options displayed: Combined. Regional VP, Manager. If I select Regional VP I only want to display in the list Combined and Manager. If I'm Manager my only option should be combined. 

In trying to find information for this scenario, it seems like perhaps I need to figure out something ironpython related in order to call the document property to show/hide? Or does that just hide my entire list box? 

Any resources that you can point me to would be greatly appreciated. I've dug into several videos and also tried to read through documentation to follow along and make sense of how to accomplish these two items, but I've hit a wall.

Link to comment
Share on other sites

Posted (edited)

Spotfire version 14.0.2

Well for point 1 I am entirely hitting a wall of how to achieve. I'm trying to pass the selected value of the Document Property into the text area. I feel like I've found many of different javascript items but all I found was passing to an input box, which is not exactly what I want. Wanted to try to dynamically bring in a header as text above the next filter that says: "Choose [pTest2 value]:". I can live without this, I'm just trying to learn.

image.png.731a54ffc6abcd0df4cb0df28ae864c9.png

For point 2, the closest I've been able to find information on is more of a "show/hide" scenario with javascript, but I am certainly missing something in this or using syntax incorrectly.

What I want to do is if pTest2 the user selects VP, then I want a drop down that only displays the options: Combined. Regional VP, Manager
If the user selects Regional VP, then the drop down should display the options: Combined and Manager

For Manager, there's really no need for the drop down as that's the lowest level we're going.

The only way I've been able to try to achieve this is by creating 2 more property controls: pR1, pR2
I couldn't figure out a way to alter the fixed values to only display certain options based on selection of pTest2.

image.png.7ef4a92b503a7370e57d2deced370b70.png

So I thought I could be "clever" and try to pull the text from pTest2 and show/hide pR1, pR2 or both depending on the selection. However even in trying the most simplest, just trying to do a show/hide on one control, I'm clearly doing incorrectly because the drop down is still displaying no matter what I select on pTest2.
image.png.1e7699f84a4d14487ce64130d9220af6.png

image.png.4297eed16894aa1a70bf9472e8a46989.png

 

 

Edited by KHart
Link to comment
Share on other sites

Hi KHart,

You could achieve the first point with a label in the text area, like this:

image.png.a9e9de53c2711d640ec6bf137dfed181.png

When changing the selected value, this will be immediately reflected in the label above:
image.png.813cfde7e2ba18522b6cbea53cac62d4.png
Regarding point 2, it looks to me like it should be possible, I'll ask a colleague to have a look at that one.
My line of thought was to create two lists (in document property like (CEO,VP,Regional Manager)) and use an iron python script to toggle between the lists (depending on the initial selected value). The first part, creating lists in document properties can be found here:

But I haven't yet found a way to transfer the list back  into a drop down list property (hence my colleague's advice).

I will get back as soon as possible.

Kind regards,

David

 

Link to comment
Share on other sites

You are absolutely right about the label and I can't believe I forgot that I can do that 😅 This certainly resolves point 1 for me. 

Much appreciated David!

-K

Link to comment
Share on other sites

The following may help for point 2-

Quote

"2) I want to create a "new" list for the user. This list doesn't exactly exist but would be dependent on the value in the document property referenced above. If I am VP, in this list I want to have the following options displayed: Combined. Regional VP, Manager. If I select Regional VP I only want to display in the list Combined and Manager. If I'm Manager my only option should be combined. "

You could try loading in a table, building a calculated column, and sourcing your List box using the calculated column values.

  • Load in a table like this
    • Type Values
      VP Combined
      VP Regional VP
      VP Manager
      RVP Combined
      RVP Manager
      Manager Combined
  • Add a calculated column to the new table and call it "List":
    • if(DocumentProperty("pTest2")=[Type],[Values],null) 
    • It is important to note that you will need to add this calculated column to the final table block in the data canvas. If you add this calculation to an inner block on the canvas, you will see that the calculation will not update automatically when you make selections in your List box. 
      • image.png.de35e18fe529a7100ba44de69f6fa49d.png
  • Update your List box to source using "unique values in column", select the new table, and pick the "List" column

Example

image.png.0d7fd34953153db8c2a49c990d9c3220.png

  • Like 1
Link to comment
Share on other sites

Anthony, thank you! I was trying to avoid setting up as a data table, but if I have to I will. Good news is it will be slim, just trying to limit the data connections on this particular dashboard.

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...