Jump to content

Could I use a IronPython script to generate controls in text area?


Mark123
Go to solution Solved by Niko Maresco,

Recommended Posts

Hello,eyeryone

    Now in a text area, many controls need to be created, such as drop-down lists.
    I don't want to create them one by one with using the built-in controls, but rather generate them directly through IronPython script.
    Is there a way to achieve it?

Link to comment
Share on other sites

As a work around, you can create html5 controls such as range sliders, dropdown, input, etc. and then parse those values to a single string document property in which you can later parse using Iron Python to fulfill your needs. Populating the controls can be tricky when you deal with large amounts of data.

 

jscontrols.gif.ac75275037d10fd1c13db60d99fb578a.gif

createJSControls.js  textarea.html.txt  parseData.py.txt JavaScript_Contorls_to_Document_Properties.dxp

Edited by Jose Leviaguirre
  • Like 1
Link to comment
Share on other sites

Nice weekend,Jose.

This method is quite complicated, so I'd rather choose to create it one by one with built-in controls.
But this method is an inspiration for other developments, thank you very much.

  • Like 1
Link to comment
Share on other sites

On 8/24/2024 at 8:30 AM, jojojo said:

Thank you for the good information.

Is there a way to use iron python or JavaScript to quickly create text with '|' from the data table as written in textarea.html?

you can replace the pipe separated values with pipes "|" using a custom expression and place it as a label control on the text area

<pre id="data" xhidden>City|State|Latitude|Longitude|Population|Average Temperature (F)|Air Quality Index|Observation Date
<SpotfireControl id="label Property control here" />
</pre>

Custom expression for the label property control
 

Substitute(UniqueConcatenate(
[City] & "|" 
& [State] & "|" 
& [Latitude] & "|" 
& [Longitude] & "|" 
& [Population] & "|" 
& [Average Temperature (F)] & "|" 
& [Air Quality Index] & "|" 
& [Observation Date]),", ","\n")


 

  • Like 1
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...