PDA

View Full Version : Conditional Lookup


ABC123

Howard G. Cornett
09-02-2004, 06:20 AM
Is it possible to do a conditional lookup in WAS?

Howard

Selwyn Rabins
09-10-2004, 07:27 AM
i am not sure what you mean, but since all of the properties of the grid component can be manipulated in xbasic before the grid is actually executed, i suspect that you could dynamically change the source table for a lookup (by 'lookup' i presume that you mean a dropdownlistbox)

Howard G. Cornett
09-22-2004, 11:08 AM
I do indeed mean a dropdown box. And I have a dilemma that your solution doesn't address.

I have a grid linker grid with a header and detail section. I want to change the source of the dropdown box for the first field in the detail depending on the data entered in a field in the header. This is no problem if the header already has data in it when the grid linker is executed. But what about new records? How do I save the data in the header and then use it to decide which table to use in the dropdown box? Or is there some other way to do this??

Howard

Selwyn Rabins
09-22-2004, 06:01 PM
i don't really understand because I think you are missing a key point (or I am missing a key point in what you are trying to explain in your question - if so - sorry)

the gridLinker may show new record rows for the header grid and the child grid, but you can only do data entry into ONE of these (header or child - but not both).

actually more accurately, you can do data entry into the new record rows on both the header and the child, but you can only press ONE submit button - the button for the header, or the button for the child. so assuming you do data entry into then new record rows on both header and child, and then press the Submit button for the Header grid, the entries that you made for the child are thrown away.

so, the notion that you will be doing data entry in the child without knowing what values have been saved in the header is meaningless - it can't happen.

Howard G. Cornett
09-22-2004, 06:06 PM
You understood, Selwyn. I now understand how to do it. Thank you.

Howard

Howard G. Cornett
09-23-2004, 02:39 PM
When a grid linker loads, does the parent load before the child or at the same time? I have a number of child grids and for each record only one of them applies. It depends on the values of certain fields in the parent which child should be displayed. What I am asking is, can I write some code that will load the parent, and then choose the appropriate child based on a value that has loaded in the parent? Or would the lookup function work better to find the appropriate value and load them together? Or is there yet a better way to do this?

Howard

JerryBrightbill
09-23-2004, 03:59 PM
Howard

If you have a number of potential "child" grids that could load depending on a "parent" value, why not split them to 2 pages? Select a "parent" on one page and then load the next page showing the correct child and the selected parent. The only other solution that comes to mind is to load no child grids initially, but select the parent and resubmit the page and then take the parent selected and use its value to determine the child.

Jerry