Jump to content

Set dropdown Property control to max of quarter ironPython


HITESH SAHOO

Recommended Posts

Hi All,

I have a dropdown of Quarter(Q1,Q2,Q3,Q4). Now requirement is when ever User opens the dashboard by default dropdown should be set to current quarter.

IronPython code that I am using isDocument.Properties['QuarterSelection'] = Document.Properties['currQuarter']

where 'QuarterSelection' is document property of dropdown and 'currQuarter' is documment property created by me using Data Function that holds current quarter.

When I run above script, User can't select rest of Quarter(Q1,Q3,Q4) rather always setting to current quarter(Q2), as document property(QuarterSelection) is assigned to current quarter(currQuarter).

Please let me know what mistake am I doing or is there any other appraoch I can achieve this.

 

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Hi HS,

 

To be clear, you need the Q2 to be displayed but you want the user to be able to select another quarter if needed

 

When I set up a dropdown list, with fixed values, I can select any quarter I like. It's starts of course with Q1. I then create another document property, currQuarter, and set the defauly manually to Q2. Using your iron python script (used in the same text area under a button), I'm able to set the default to Q2 but still I am able to alter the quarters. So if I want to select Q1, I can do so.

 

Might there be something in the data function Can you share the dxp

 

kind regards,

 

David

Link to comment
Share on other sites

Hi HS,

The problem lies in the fact that your script is always returning Q2, on every action you perform on it.

So, basically, I would suggest to forget about the script and use only the data function. You can set the output parameter of the data function, to the 'QuarterSelection' document property directly. This will allow the setting to the current quarter upon opening of the dashboard, but it enables users to change the quarter via the drop-down when needed.

I have attached the 'fixed' dashboard, hope you can open it (I'm on Spotfire 10.9).

Kind regards,

David

Link to comment
Share on other sites

The issue is happening because you have an IronPython script set to be triggerred when ever the dropdown changes with the below script that sets the dropdown always to Q2

Document.Properties['QuarterSelection'] = Document.Properties['currQuarter']I think you will have to rather set the IronPython script to be executed on the property "currQuater" instead of "QuaterSelection" that should help resolve the issue

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