You can do this today, but it requires a bit of JavaScript coding to 'refresh' the widget with different parameter values.
First of all, if you want to update the 'selection criteria' in a drop down without going back to the server, you cannot bind the 'choices parameter value' property. All SQL properties are evaluated entirely on the server for security purposes.
The ONLY exception to this is 'choices parameter value' and 'parameter value' (same property, but named differently on some widgets). These are evaluated on the server if they are bound, but if not bound the values can be accepted from the browser. The reasoning for this is to allow for what you are wanting to do here.
With the above in mind, and extending the example above to give the company box an id of 'company' and the division box an id of 'division', you can...
Set the 'choices parameter value' on the division box to this:
This sets the parameter value when the screen loads to be the value from the company box, so that it's set properly when the screen is first displayed.
Then, whenever the 'company' drop down box is changed, you have to update the parameter value in the division drop down box and trigger a 'refresh' of the widget, by using code like this in the 'onchange' property of the company drop down box:
Code: Select all
applyProperty("division", "choices parameter value", get("company"));
applyProperty("division", "field type", "select box"));
See here for details on the APIs used:
http://www.profoundlogic.com/docs/displ ... y+Used+API
It's the last 'applyProperty' call which refreshes the widget. Apply the 'field type' value EXACTLY as you see it in the designer properties for the widget. This will basically cause PUI to re-render the widget with currently set property values.
Keep in mind that this technique could be a security concern, depending on your usage. Basically you are allowing the user's web browser to supply the 'choices parameter value' in this case. A malicious user could update this value to whatever they want quite easily. Although ONLY this value, the rest of the SQL statement cannot be altered in any way.
An easy way to think of it this way -- you should only use this technique (unbound parameter values) when there is no possible value of the parameter that will result in the user seeing data they shouldn't.
The way PUI secures these components, this is the only part of the SQL statements that you have to consider. If you do not use parameter markers, or if you do use them but bind all the values, then ZERO parts of the SQL statement can be altered and there is nothing to worry about.