I've got a fairly simply query I hope. I know the problem is, however I just can't figure out how to do this. I have a data grid form with 4 fields on it. I want to query my database and the populate the 4 fields in the form with the data that has been returned. i can seem to do this with a data grid table fine, its the forms I'm having trouble with as I need to convert the returned data into an array so I can handle.
Here is the code I have so far on the opencontrol handler for the data grid
Code: Select all
if (gConnID > 0) then
put "SELECT description, item_price, qty, line_price FROM purchase_line WHERE OrderID =" && "'" & tOrderID & "'" & "ORDER BY lineID" into tTheSQLQuery
put revDataFromQuery(tab, cr, gConnID, tTheSQLQuery) into tTheData
set itemdelimiter to tab
put 1 into Counter
if tTheData begins with "revdberr," then
delete item 1 of tTheData
else
repeat for each key tIndex in tTheData
put item 1 of tIndex into tTheArrayData["label 2"]
put item 2 of tIndex into tTheArrayData["label 3"]
put item 3 of tIndex into tTheArrayData["label 4"]
put item 4 of tIndex into tTheArrayData["label 5"]
dispatch "AddData" to me with tTheArrayData, tIndex
--set the dgData of me to tTheArrayData
end repeat
end if
Code: Select all
on FillInData pDataArray
if (pDataArray["label 1"] is a color) then
set the backcolor of graphic "Background" of me to pDataArray["label 1"]
end if
set the HTMLText of field "fld_description" of me to pDataArray["label 2"]
set the text of field "fld_item_price" of me to pDataArray["label 3"]
set the text of field "fld_qty" of me to pDataArray["label 4"]
set the text of field "fld_line_price" of me to pDataArray["label 5"]
end FillInData
Thanks
Jalz