Dynamic SQL datasource for Dropdown

Hi all…
First, I feel like I have completely lost the plot! Here’s the problem:
Main window with 6 buttons, one for each line (line 1 thru line 6)
A container with a dropdown in it - I want the dataset to be related to the line selected by way of the buttons.

ie. press button for line 1 and the dropdown is populated with a “SELECT this, that and the other FROM thisTable WHERE location = Line 1”

same for the other lines…

For some reason, besides the obvious (me being mindless and all) :laughing: , I can’t get it to work properly.

then after setting that straight, there will be an another dropdown that is populated based on the selection of the first dropdown, then a box for a numeric entry - and to wrap it all up - insert the record back to the associated db tables! whew!

TIA
travis

Travis,

Okay, so the technique you’d want to use here is to create a dynamic property (maybe on the root container, or wherever you’d like) that represents the part of the query that changes (i.e. 1,2,3, etc, representing the line). Have your 6 buttons set that property to the appropriate value. Then you’d bind that property directly into your query.

More explicitly:

[ol]
[li]Create an integer dynamic property on the root container called LineNum.[/li]
[li]Configure an action for the actionPerformed event on button 1. Use the Set Property action, and set the LineNum property to 1[/li]
[li]Repeat step 2 for the other 6 buttons, setting LineNum to the appropriate value.[/li]
[li]Bind the dropdown’s Data property to a SQL query, like this: SELECT value, display FROM thisTable WHERE location = {Root Container.LineNum}[/li][/ol]

You should be able to extrapolate this technique out to your other dropdowns, by using the first dropdown’s Selected Value property. Let us know how it goes, and when you get to it, we can work on the insert part of the window.

Hope this helps,

Thats how I was planning - just couldn’t get my head straight!