I am learning how to write and call a functions in JMP (coming from Matlab).
Trying to pull data for a tested part from database via a SQL query.
Wrote two separate scripts. One is a function with PartID as the input variable and the test data table as output.
Other script is the function call, but I do not seem to be able to pass the partID to the function. Where I am going wrong?
My function call
partDataTable = getDataTable4partID("PART16.0009")
My function
getDataTable4PartID = Function( {PartID},{partDataTable},
Open Database(
"Driver=SQL Server;
Server=XAB-SQL02;
DATABASE=TBSDF;
Trusted_Connection=Yes;",
"SELECT * FROM dbo.View_BBX a WHERE a.Part like 'PartID' AND a.TestDateTime > '2021-02-01'",
"partDataTable" // name of the output data table
);
);
The SQL query itself works when PartID is replaced by the actual part number PART16.0009 and run separately spitting the desired data table, but when I use the function call, the data table still has 'PartID' in the Source/ Update From DB scripts in the empty data table.
When it's too good to be true, it's neither