paulW
Posts: 24
|
| Posted: 12/10/2009, 1:37 PM |
|
I have an editable grid that prints records from Table A, and every row has a listbox whose control source is one db column in Table A. The listboxes are filled from fields in Table B. However, I need the option available in the listboxes to change depending on what the value in Table A is. Basically, the listbox shows the current state of the row, and the available states change depending on what state the record is in. The list of state transistions is kept in another table, Table C.
For the Data Source property, I have my custom SQL statement, but here is where I run into a snag.
SELECT id, name
FROM tableB
INNER JOIN tableC
ON tableB.pk=tableC.fk
WHERE tableC.pk=tableA.current_val
The snag in that I don't know how to refer to 'tableA.current_val' in my SQL statement...I have tried adding a SQL Parameter of type Control, DataSource Column, etc, but I can't seem to get it right...
Any help would be appreciated.
|
 |
 |
datadoit
|
| Posted: 12/10/2009, 6:35 PM |
|
Looks like you'll need to use custom coding for the listbox WHERE
parameters. See the help file for Dynamically Modify Listbox.
Your WHERE parameter will be a data column value. ie:
WHERE tableC.pk = $Container->ds->f("tableA.current_val")
|
|
|
 |
paulW
Posts: 24
|
| Posted: 12/11/2009, 7:49 AM |
|
That sounds like it should work, but I can't seem to get the current value of the control in order to put it in my "WHERE" clause...
I have tried the following:
$Container->ds->f('tableA.current_val')
$form->control_name->GetValue()
$form->ds->control_name->GetValue()
$form->ds->control_name->GetDBValue()
$form->ds->f('tableA.current_val')
$form->ds->f('current_val')
$form->DataSource->control_name->GetValue()
$form->DataSource->control_name->GetDBValue()
$form->DataSource->f('tableA.current_val')
$form->DataSource->f('current_val')
|
 |
 |
datadoit
|
| Posted: 12/11/2009, 5:33 PM |
|
Show us your SQL for the editable grid, then show us your custom code.
|
|
|
 |
damian
Posts: 838
|
| Posted: 12/13/2009, 2:36 AM |
|
possibly its not working because of the order in which various things are being executed....
because the listbox is referencing values in the same row it would probably have to execute the custom sql in before show row event. if this is the case then you probably need to approach this differently.
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
|