Funny Cat Posted 20 hours ago Share Posted 20 hours ago (edited) Hi, I wonder if there is a way to load on demand data for multiple document properties. The user populates 3 different properties with dropdowns. Now I want to feed the three properties into the on Demand selection. Is there an expression for that? The only possibility I found is to create another string list property and use this in the on demand. from System.Collections.Generic import List Document.Properties["propList"] = List[object]([Document.Properties["prop1"], Document.Properties["prop2"], Document.Properties["prop3"]]) by the way, is there also a ironPython way to change the on demand input from Range to Values, Expression/Property/Fixed value, etc.? Edited 20 hours ago by Funny Cat Link to comment Share on other sites More sharing options...
barchiel33 Posted 18 hours ago Share Posted 18 hours ago (edited) Let me preface this by saying that I'm not an "expert" and there's plenty of things that I don't know, but I still wanted to take a shot (doing so helps me learn tbh). You want to feed three properties into a single on-demand field? Are the three properties three separate values (ie. you'd want to feed a list into the on-demand field) or should they be joined (ie. string concatenation, summation, etc)? I assume the former, in which case the solution you've got is probably the best way to do it. I can't think of another way that would be simpler, like you could add three calculated columns to a table and then unpivot it in a new table but that wouldn't be worth the overhead. If you don't need the values to be separate input fields, you could try using a string list input via a multiline input control. As far as I'm aware, there isn't currently a way to replace the on-demand settings of an existing table (there used to be an Ideas post requesting this, but I can't seem to find it anymore). At least, not without essentially replacing the whole table, basically deleting the table and adding a new one with the same name. The methodology to do this is a bit complicated, you'd basically have to build a data flow using a new InformationLinkParameter object as the base then build on it using the transformations from the original table's source view. I couldn't find an article or anything explaining exactly how to do this, I just worked through the API manually, using some previous experience I've had with data flows (I wrote a script a while back that switched the join method of an add additional columns join). It'd probably be easier to just add the data source twice in the data flow, once loading using a range and the other loading using values. Then you can join them together using append rows, making sure to include the data origin identifier, and filter to whichever method you want using a document property (or whichever method you prefer). Edited 17 hours ago by barchiel33 Link to comment Share on other sites More sharing options...
Funny Cat Posted 14 hours ago Author Share Posted 14 hours ago Hi barchiel33, thank you very much. I also think I've got the best solution already. The data type string list is not allowed for input field (multiple lines). The only option would be a List box (multiple select), but anyway at a later stage I need to know which selection is which, so I need to have the 3 separate parameters. Regarding replacing on-demand settings. That's a pitty. For another use case than the previous one I wanted to make a user selection with the below options. Since I can't change the on demand settings with ironpython I need to use a range and two properties (property1 and property2) which I populate with the ironPython script. One item --> property1 = property2 = user input Multiple items --> not possible since I can't feed string lists into the onDemand range Range --> property1=min(user input), property2=max(user input) Or time span --> property1 = 'A', property2 = 'ZZZZZZZZZZZZZZZZZZ' I can live with that :) Link to comment Share on other sites More sharing options...
barchiel33 Posted 12 hours ago Share Posted 12 hours ago Hello @Funny Cat, You could use a data function to convert your string list(s) into a table and then use a column from that table to load on-demand. Basically, you'd use Ironpython script to convert the string list(s) into a single string of delimited values (ex. "prop1,prop2,prop3"). That script would look something like this: input_list = Document.Properties["listUserInputList"] Document.Properties["tempFun"] = ",".join(input_list) Just replace "listUserInputList" with your String List document property's name and "tempFun" with your string document property that'll contain the list converted into a comma delimited string. The script would trigger on the listUserInputList being changed, which would update the tempFun property. Then, in a Python data function, you convert that string to a python list using split() and output that list as a table. This data function should refresh automatically, which should cause it to trigger when tempFun is updated by the Ironpython script. The function could be super simple: output_column = input_list.split(",") Where output_column is a data table which will have one row for each property (ex. row 1 = "prop1", row 2 = "prop2", row3 = "prop3") and input_list is your string (aka tempFun). 1 Link to comment Share on other sites More sharing options...
Funny Cat Posted 8 hours ago Author Share Posted 8 hours ago Hi @barchiel33, right, that would be a way for using the input field (multiple lines). For my use case, I don't see the advantage though. It must be clear for the user in which order they have to enter the 3 parameters, so the dropdowns are a good possibility. Additionally, they can search in the dropdown for possible values when they start typing and since they can select only predefined values, there's no need to avoid typos. Thank you very much though! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now