Using JOINS to build datagrid
Posted: Mon May 09, 2016 10:58 am
Good morning,
Is it possible to use joins to build columns in a datagrid? I have a "sales" datagrid that has a column productID, I want the datagrid to display the name. My code looks like this:
Columns in my datagrid for products would be products.prod_name for example. The products information is in the returned array but I don't know how to reference it.
Please help
Is it possible to use joins to build columns in a datagrid? I have a "sales" datagrid that has a column productID, I want the datagrid to display the name. My code looks like this:
Code: Select all
put sqlquery_createObject("sales") into theQueryA
sqlquery_set theQueryA, "related table joins", "LEFT OUTER JOIN customers, LEFT OUTER JOIN products"
sqlquery_set theQueryA, "order by", "sales.sales_ID"
sqlquery_retrieveAsRecords theQueryA, theDataA
put the result into theError
if theError is empty then
set the dgData of group "salesDataGrid" to theDataA
end if
if theError is not empty then
answer "Error populating customers:" && theError & "."
end if
Please help