Hello!
I have a data table that was produced via a script running two separate queries (that provide data from two different sources) which are then merged to form a data table. My question is with regards to updating this table daily in a way that the script doesn't need to be re-run from the start and any cleaning/adjustments/new columns can be kept. I see on the side bar there is both an "update from database" and "update from database2". I can run one of them, but it will delete the columns that are not included from that source (i.e., it I run "update from database", which is for the first query, it will delete columns TVC, VI, AC and DC from query 2 along with other calculation/manual entry columns I add to the table after merging in the original script).
I have tried copying the two update scripts together into one script (see below) but have the issue where when it runs the first one it will try to delete the columns before running the second. I'm not sure if the best approach would be to combine the tables and then try to update or if there is something simpler (maybe a way to have it update without deleting data that doesn't come from that source)? I removed the connection information and changed around names in the code below, but hopefully this helps to give an idea. Has anyone dealt with a similar problem before? Thanks!
New SQL Query(
Version( 130 ),
Connection(
""
),
QueryName( "query1" ),
Select(
Column( "Assay", "t1" ),
Column( "Experiment", "t1" ),
Column( "Date", "t1", Numeric Format( "m/d/y h:m:s", "0", "NO", "" ) ),
Column( "G", "t1" ),
Column( "L", "t1" ),
Column( "N", "t1" ),
Column( "K", "t1" ),
Column( "C", "t1" ),
Column( "H", "t1" ),
Column( "O", "t1" ),
Column( "C", "t1" ),
),
From( Table( "Runs", Schema( "schema1" ), Alias( "t1" ) ) ),
Where(
Contains(
Column( "Experiment", "t1" ),
"E001",
UI(
Contains(
Base(
"Categorical",
Prompt(
"Experiment ID:",
Character,
PromptName( "t1.Experiment_1" )
)
)
)
)
) & Does Not Contain(
Column( "Assay, "t1" ),
"xxx",
UI(
Contains(
Base(
"Categorical",
Prompt(
"Add a filter for names (optional) or put xxx:",
Character,
PromptName( "t1.AssayId_1" )
)
)
)
)
) & GE(
Column(
"Date",
"t1",
Numeric Format( "m/d/y h:m:s", "0", "NO", "" )
),
0,
UI(
Comparison(
Base(
"Continuous",
Prompt(
"Date range:",
Character,
PromptName( "t1.RunDate_1" )
)
)
)
)
)
)
) << Run Foreground( UpdateTable( Current Data Table() ) );
New SQL Query(
Version( 130 ),
Connection(
""
),
QueryName( "query2" ),
Select(
Column( "Assay", "t2" ),
Column( "Experiment", "t2" ),
Column( "Date", "t2", Numeric Format( "m/d/y h:m:s", "0", "NO", "" ) ),
Column( "TVC", "t2" ),
Column( "VI", "t2" ),
Column( "AC", "t2" ),
Column( "AD", "t2" )
),
From( Table( "Runs", Schema( "schema2" ), Alias( "t2" ) ) ),
Where(
Contains(
Column( "Experiment", "t2" ),
"E001",
UI(
Contains(
Base(
"Categorical",
Prompt(
"Experiment ID:",
Character,
PromptName( "t2.Experiment_1" )
)
)
)
)
) & Does Not Contain(
Column( "Assay", "t2" ),
"xxx",
UI(
Contains(
Base(
"Categorical",
Prompt(
"Add a filter (optional) or put xxx:",
Character,
PromptName( "t2.AssayId_1" )
)
)
)
)
) & GE(
Column(
"Date",
"t2",
Numeric Format( "m/d/y h:m:s", "0", "NO", "" )
),
0,
UI(
Comparison(
Base(
"Continuous",
Prompt(
"Date range:",
Character,
PromptName( "t2.RunDate_1" )
)
)
)
)
)
)
) << Run Foreground( UpdateTable( Current Data Table() ) )