Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Sully
Level III

Use Cell Value to Insert into a Query

Hello,

Is it possible to use a cell value and insert that into a query? I have a table (shown below) and I would like to use the column "Query", to use only one cell value and place into my query statement. Maybe assign the cell value and plug that into the query?

Table:

MonthYearDaily?Table NameQuery
72019NotTRANS_0719TRANS_0719
82019NotTRANS_0819TRANS_0819
92019NotTRANS_0919TRANS_0919
102019NotTRANS_1019TRANS_1019
112019TRANS_DAILYTRANS_1119TRANS_DAILY

 

Query:

data_sql = evalinsert("Select *
FROM *want to insert specific value from Query column*
WHERE Date between '2019-08-01' and '2019-08-31'
");
data_dt = Execute Sql (dbc, data_sql)

I have all of this in a JSL but just wanted to figure out this last piece for it.

 

Any help or advice greatly appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Sully
Level III

Re: Use Cell Value to Insert into a Query

So... after some playing around and additional research this can be done pretty easily just assigning a value to the cell using (Column (5)[1]). My solution below:

query1 = (Column(5)[1]); 
query2 = (Column(5)[2]); 
query3 = (Column(5)[3]); 
query4 = (Column(5)[4]); 
query5 = (Column(5)[5]); 

data_sql = evalinsert("Select* 
FROM ^query1^ 
WHERE Date between '2019-08-01' and '2019-08-31'
"); 
data_dt = Execute Sql (dbc, data_sql); 

 

 

 

View solution in original post

1 REPLY 1
Highlighted
Sully
Level III

Re: Use Cell Value to Insert into a Query

So... after some playing around and additional research this can be done pretty easily just assigning a value to the cell using (Column (5)[1]). My solution below:

query1 = (Column(5)[1]); 
query2 = (Column(5)[2]); 
query3 = (Column(5)[3]); 
query4 = (Column(5)[4]); 
query5 = (Column(5)[5]); 

data_sql = evalinsert("Select* 
FROM ^query1^ 
WHERE Date between '2019-08-01' and '2019-08-31'
"); 
data_dt = Execute Sql (dbc, data_sql); 

 

 

 

View solution in original post

Article Labels

    There are no labels assigned to this post.