6

I'm using an IronPython script to reset all filters and also set some document propertries. The document property below "FUTUREONLY" is a drop-down property control with 3 possible selections based on expressions. When I run the script it reset the document property to '--' and causes all visualizations affected by it to be blank. In case it's a list, I've tried ... = ["FUTUREONLY"][1] as well as ... ["FUTUREONLY"] = "SECOND TEXT ITEM IN DROP DOWN STRING" as well as ... ["FUTUREONLY"] = expression used to create drop down item.

Any idea how to specifically set a drop-down item currently in the drop-down list? Below is a code snippet (it works but sets the property drop-down to '--' instead of 'SECOND TEXT ITEM IN DROP DOWN STRING':

dp = Document.Properties
dp["FUTUREONLY"] = ""

Thank you,

Chris

Chris
  • 495
  • 1
  • 9
  • 26

1 Answers1

10

you can do this on one line like:

Document.Properties["FUTUREONLY"] = "myvalue"

the reason your dropdown is being set to "---" is because "myvalue" doesn't exist in the list. you must select a valid value that you've specified in the property control options.

niko
  • 3,946
  • 12
  • 26
  • That's what I thought too so when I specify ["FUTUREONLY"] = display value OR expression from the drop-down list I still see the ---. – Chris Apr 04 '18 at 19:33
  • 1
    I tried that before. I must've had a space included because it didn't work. After opening column properties I could see what each document property was set to and I ended up copying+pasting into the script. It works now. Thank you, @Niko! – Chris Apr 04 '18 at 22:29
  • 1
    Beat me to it ;) I was going to suggest copy paste until life attacked. Glad that you got it sorted! – niko Apr 04 '18 at 22:50