Dynamically add custom properties

#1

I am trying to build a custom query based on some dropdown and list boxes. User selects table and column, then adds specific cell to a custom string property which will then be used in a dynamic query. Not sure how many additions will go into the query so having a set number of custom properties may be difficult. Is it possible to dynamically add custom properties through scripting while a user adds values to the query?
Thanks!

0 Likes

#2

Seems like this won’t work. I believe the jdbc drivers won’t allow for substitutions in the query structure

0 Likes

#3

You could assemble a custom WHERE clause string and pass that to your query as a querystring.
Not the safest option, but if the composition of that string is limited to dropdown and listbox selections then you should be fine.

Edit: I misunderstood. @dkhayes117 is right that you can’t alter existing query structures. Nothing is stopping you from assembling your entire query as a string and using system.db.runQuery though.

1 Like

#4

Is this in Perspective, or Vision?

Using a named Query would allow you to use QueryStrings instead of values. This CAN be a security risk, but if you’re reading values from your own dropdown it should be pretty safe.

You’d want to do something like this, you would just ned to make sure that you supply a properly configured list of ids or whatever you want to select from.

0 Likes

#5

Thanks for the feedback, This is in Vision.
Ok seems like the simplest way would be to assemble the query in a python script first.

In the Named Query scenario, this could have a variable number of strings to the query? Say if they want to query 1 to 10 items.

0 Likes