Can't find procedure in report table selection
Posted: Thu Jun 27, 2019 6:31 pm
I just tried to do something similar to https://forums.nubuilder.cloud/viewtopic. ... 848#p18607 creating a temp table to act like an M$ Access subquery then creating a master table with the
and also tried to create a second table then
no matter what I try the procedure DOES NOT show up in the table list for the report.
Here is the full code of my procedure
*note i'm working off of existing data that was poorly built 20 years ago in Access I've modified some of the column and table names so I don't have #'s and /'s all over my column and table names*
If I run it from run procedure i get three tables the two described and a __gibberishstring__ table with the correct data
Code: Select all
Create TABLE #TABLE_ID# AS ...
Code: Select all
Create TABLE #TABLE_ID# SELECT * FROM [Second Table]
Here is the full code of my procedure
*note i'm working off of existing data that was poorly built 20 years ago in Access I've modified some of the column and table names so I don't have #'s and /'s all over my column and table names*
Code: Select all
$a = "DROP TABLE IF EXISTS DataForRptAllUnitsMasterListSub1;";
nuRunQuery ($a);
$b = "SELECT
tblCurrentRentedUnits.UnitNumber,
CONCAT(IF(tblTenants.BusinessName != '', tblTenants.BusinessName,''), IF(tblTenants.BusinessName != '' AND tblTenants.LastName != '', ' - ', ''), IF(tblTenants.LastName != '', tblTenants.LastName, ''), IF(tblTenants.LastName != '' AND tblTenants.FirstName != '', ', ', ''), IF(tblTenants.FirstName != '', tblTenants.FirstName, '')) AS FullName,
tblTenants.TenantID,
tblCurrentRentedUnits.MoveInDate,
tblCurrentRentedUnits.Rate,
tblTenants.HomePhone,
tblTenants.BusPhone
FROM
tblCurrentRentedUnits
JOIN tblTenants ON tblCurrentRentedUnits.AssocTenantID = tblTenants.TenantID
WHERE
tblCurrentRentedUnits.Vacated = False
ORDER BY
tblCurrentRentedUnits.UnitNumber ASC;";
nuRunQuery ("CREATE TABLE DataForRptAllUnitsMasterListSub1 AS $b;");
$c = "DROP TABLE IF EXISTS DataForRptMasterListOneLocation;";
nuRunQuery ($c);
$d = "CREATE TABLE DataForRptMasterListOneLocation AS SELECT
tblUnits.UnitID,
IF(DataForRptAllUnitsMasterListSub1.TenantID IS NULL, 'VACANT', 'Rented') AS UnitCondition,
tblUnits.Location,
tblUnits.Size,
IF(DataForRptAllUnitsMasterListSub1.TenantID IS NULL, '', DataForRptAllUnitsMasterListSub1.FullName) AS RentedBy,
DataForRptAllUnitsMasterListSub1.HomePhone,
DataForRptAllUnitsMasterListSub1.BusPhone,
DataForRptAllUnitsMasterListSub1.MoveInDate,
DataForRptAllUnitsMasterListSub1.Rate,
tblUnits.UnitSort
FROM
tblUnits
LEFT JOIN DataForRptAllUnitsMasterListSub1 ON tblUnits.UnitID = DataForRptAllUnitsMasterListSub1.UnitNumber
INNER JOIN tblLocationToUse ON tblUnits.Location = tblLocationToUse.Location
ORDER BY
tblUnits.UnitSort;";
nuRunQuery($d);
$e = "Create TABLE #TABLE_ID# AS SELECT * FROM DataForRptMasterListOneLocation";
nuRunQuery($e);