Re: Subform using computed query
Posted: Tue Oct 20, 2020 6:50 am
Basically, you can have enter any table for a Browse (even if you create a dummy one for that purpose).n9yty wrote:admin wrote:
Back to building a browse form... It requires a table name, but I don't have an underlying table, it is entirely an SQL statement. So do I just use #TABLE_ID# as the table name when I define the form and have the SQL return that as the table name for the data it is providing? I'm not seeing how the two get connected to be the same underlying table, but the magic must be in there somewhere.
It's just important to have the primary key column of that table in your select (can be created like this: null as mytable_id, see below)
In the example below the table mytable is entered in the Browse but fields from another table (test) are selected.
Before Browse (PHP)
Code: Select all
$s = "CREATE TABLE #TABLE_ID# SELECT null as mytable_id, field00, field01, field02 from test ";
nuRunQuery("$s");
Code: Select all
SELECT * FROM #TABLE_ID#