Multiple queries - resulting template from the Database Integration Wizard

If you use the Template Wizard to edit this template, you will notice that by default, all three SQL statements are configured to be run in just one template cell.  Also, your 'TODO' placeholders remain embedded in the template code and SQL statements.  A simplified copy of this template is displayed below.  Elements that need to be edited have been highlighted.  You should also note the relative locations of the columns designated for the "Outer Query" and the "Inner Query".

As it stands now, the multi-query template produced by the Database Integration Wizard will not correctly enter your defect data into GainSeeker.  You must use the Template Wizard to modify this template so that it works correctly.

Column
Heading

Cell

Formula

Connect

B1

NVar 81 = Q_CONNECT 1, "Defect_Data", "Y", "N":

NVar 82 = Q_CONNECT 2, "Defect_Data", "Y", "N":

NVar 83 = Q_CONNECT 3, "Defect_Data", "Y", "N":

NVar 89 = Q_CONNECT 9, "GainSeeker71_B", "Y", "N":

If NVar 81 = 0, GOTO [S1]

Outer Query

C1

SVar 81 =  "Select * from LOG_ALL where Processed = 0":

NVar 81 = Q_START 1, SVar 81:

SVar 82 =  "Select * from LOG_FAIL where Processed = 0":

NVar 82 = Q_START 2, SVar 82:

SVar 83 =  "Update LOG_ALL set Processed = 1
where Processed = 0 and DateTime = 'TODO'
and PartNo = 'TODO' and Serial = 'TODO'":

NVar 83 = Q_START 3, SVar 83:

If NVar 81 = 0, GOTO [S1]

Inner Query

D1

'Add inner Q_START statements in this column'

DMS Set

M1

DB_RESET 0:

DB_SET_VALUE "Part_Number", SVar 95:

DB_SET_VALUE "Process", SVar 94:

DB_SET_VALUE "DateTime",
(Date_Format Q_COLUMN 1, 2, "", "MDY"):

DB_SET_VALUE "Sample_Size", '1':

DB_SET_VALUE "NCU",
(CONCAT Q_COLUMN 1, 3, "",
'TODO: Pass = 0 NCU.  Fail = 1 NCU')
:

DB_SET_VALUE "Defect_Count1", '1':

DB_SET_VALUE "Defect_Description1",
(CONCAT Prep_Q Q_COLUMN 2, 2, "", 'TODO')
:

DB_SET_VALUE "Trace_1", Prep_Q Q_COLUMN 1, 0, "":

DB_SET_VALUE "Trace_4", Prep_Q Q_COLUMN 1, 4, ""

DMS Save

N1

SVar 93 = DB_DATA_SQL "DMS*":

NVar 99 = Q_EXECUTE 9, SVar 93

Inner Next

P1

'Add inner Q_NEXT statements in this column':

'If Q_NEXT n = 1, GOTO [E1]'

Outer Next

R1

If Q_NEXT 1 = 0, GOTO [S1], GOTO [D1]:

'Q_NEXT 2':'Q_NEXT 3'

Terminate

S1

Exit

 

More:

Final version of the template

Working with multiple SQL statements