<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create UI to help build sql queries in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422184#M67125</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4550"&gt;@pmroz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate the help and very much like your idea as well&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i run the script as-is, the embedded log does not pick up on my selections and instead shows emptiness even though i made selections&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;"Select *
   from TABLE.DATA
  WHERE SCANDATETIME &amp;gt; (SYSDATE - 30)
    )
    )"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How can this be remedied?&lt;/P&gt;</description>
    <pubDate>Wed, 29 Sep 2021 17:49:08 GMT</pubDate>
    <dc:creator>Tom_P</dc:creator>
    <dc:date>2021-09-29T17:49:08Z</dc:date>
    <item>
      <title>Create UI to help build sql queries</title>
      <link>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/421824#M67067</link>
      <description>&lt;P&gt;I'm looking to create a JMP UI where a user selects a program to run and adds in some data filter options to the end [after where statement] or middle [from statement] of an SQL query.&amp;nbsp; My first problem is that i think i'm assigning the user entered/selected data incorrectly to a new variable (see row 45---&amp;gt;DataParam_1).&amp;nbsp; Then i'm not sure how to assign the filter selection statements ("AND ....")&amp;nbsp; and merge it all back into one larger program SQL statement.&amp;nbsp; I tried to take all of the user entered data and pass it back to a function called SUB_QUERY_1, manipulate it there and finally pass it to a the final query function SQL_Query_1 but this appears to not work.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Clear Log();

SUB_QUERY_1 = Function( {Company_1, Company_2, Product_1, Product_2, Program_1, Program_2}, 
	//create query substatements for sql insertion after the main WHERE statement
	code_1 = If(
		(Company_1 != 0) &amp;amp; (Company_2 != 0), Eval Insert( "AND (COMPANY LIKE '%^Company_1^%' OR COMPANY LIKE '%^Company_2^%))" ),
		(Company_1 != 0), Eval Insert( "AND COMPANY LIKE '%^Company_1^%')" )
	);
		
	code_2 = If(
		(Product_1 != 0) &amp;amp; (Product_2 != 0), Eval Insert( "AND (PRODUCT LIKE '%^Product_1^%' OR PRODUCT LIKE '%^Product_2^%))" ),
		(Product_1 != 0), Eval Insert( "AND PRODUCT LIKE '%^Product_1^%')" )
	);

	Show( code_1, code_2 );	
	//based on selected checkbox, run the query associated and insert code_1,code_2 at end of sql statement
	If(
		Program_1 != 0, SQL_Query_1( code_1, code_2 ),
		Program_2 != 0, SQL_Query_2( code_1, code_2 )
	);
);

//Final query to run based on altered info from user-interface &amp;amp; SUB_QUERY function
SQL_Query_1 = Function( {code_1, code_2},
	sql_statement_1 = Eval Insert( "Select	*
    from TABLE.DATA
    WHERE SCANDATETIME &amp;gt; (SYSDATE - 30)" + code_1 + code_2 );
	Show( sql_statement_1 );
	Open Database( "DSN=xxx;UID=xxx;PWD=xxx;", sql_statement_1, "Table1" );
);

//SQL_Query_2 will be copy of SQL_Query_1 with different sql statement
//ignore that it is missing for the moment

//user-interface
ww = New Window( "Epi JMP Data Query",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;return result,
	V List Box( Spacer Box( Size( , 10 ) ) ),
	H List Box(
		Border Box( Sides( 15 ),
			V List Box(
				Text Box( "Select Program to Run:" ), 
				//User selects program to run
				DataParam_1 = Check Box( "Option_1", Program_1 = DataParam_1 &amp;lt;&amp;lt; Get ), //am i assigning DataParam_1 user input to Program_1 incorrectly
				DataParam_2 = Check Box( "Option_2", Program_2 = DataParam_2 &amp;lt;&amp;lt; Get )  //multiplying out mistake?
			)
		),
		Spacer Box( Size( 25, 10 ) ),
		V List Box(
			Align( right ),
			Text Box( "Data Filter" ),
			Spacer Box( Size( , 10 ) ),
			Text Box( "Company:" ),
			Spacer Box( Size( , 10 ) ),
			Text Box( "Customer:" ),
			Spacer Box( Size( , 10 ) ), 

		),
		Panel Box( "",
			V List Box(
				H List Box(
				//User selects sql query filters to apply
					comboObj1 = Combo Box( {"", "AAA", "BBB", "CCC"}, Company_1 = comboObj1 &amp;lt;&amp;lt; GetSelected ),
					comboObj2 = Combo Box( {"", "AAA", "BBB", "CCC"}, Company_2 = comboObj2 &amp;lt;&amp;lt; GetSelected )
				),
				H List Box(
					comboObj3 = Combo Box( {"", "Prod1", "Prod2"}, Product_1 = comboObj3 &amp;lt;&amp;lt; GetSelected ),
					comboObj4 = Combo Box( {"", "Prod1", "Prod2"}, Product_2 = comboObj4 &amp;lt;&amp;lt; GetSelected )
				), 

			), 

		), 

	),
	V List Box(
		Spacer Box( Size( , 10 ) ),
		H List Box( Spacer Box( Size( , 1 ) ) ),
		V List Box(
			H List Box(
				Ok_btn = Button Box( "OK", SUB_QUERY_1( Company_1, Company_2, Product_1, Product_2, Program_1, Program_2 ) ),
				cancel_btn = Button Box( "Cancel" )
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:57:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/421824#M67067</guid>
      <dc:creator>Tom_P</dc:creator>
      <dc:date>2023-06-09T19:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create UI to help build sql queries</title>
      <link>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/421991#M67097</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/10976"&gt;@Tom_P&lt;/a&gt;&amp;nbsp;,&amp;nbsp; I've created a sample script here that uses explicit scope control to keep track of UI elements and provide a more succinct callback mechanism.&amp;nbsp; This is an example script and has a bunch of boiler-plate needed.&amp;nbsp; If you find yourself following this method and making many interactive UI scripts, I advise to create a library to perform the boiler-plate code automatically (JSL has a wonderful ability to use meta-programming to modify scripts before they're run).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below method allows for persistence of the inputs as well as protection on the callbacks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/* SQL Query */

self = New Namespace();
self:tool name = "SQL Setup";

Eval( Eval Expr(

self:initialize = Function( {},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	If( File Exists( "$TEMP/SQL_Setup.jsl" ),
		self:settings = Include( "$TEMP/SQL_Setup.jsl" );
	,
		self:settings = [=&amp;gt;];
	);
	self:available companies = {"", "AAA", "BBB", "CCC"};
	self:available products = {"", "Prod1", "Prod2"};
	1
);

self:content = Function( {},
	V List Box(
		H List Box(
			Panel Box( "Select Program to Run:",
				V List Box(
					self:DataParam 1 = self:Check Box( {"Option_1"}, "dataparam 1", "single select(this, 1)" )
				,
					self:DataParam 2 = self:Check Box( {"Option_2"}, "dataparam 2", "single select(this, 2)" )
				)
			)
		,
			Panel Box( "Data Filter",
				Lineup Box( N Col( 3 ), Spacing( 3 ),
					V List Box( Align( "Right" ), Text Box( "Company:" ) )
				,
					self:company 1 = self:Combo Box( self:available companies, "company 1" )
				,
					self:company 2 = self:Combo Box( self:available companies, "company 2" )
				,
					V List Box( Align( "Right" ), Text Box( "Customer:" ) )
				,
					self:product 1 = self:Combo Box( self:available products, "product 1" )
				,
					self:product 2 = self:Combo Box( self:available products, "product 2" )
				)
			)
		)
	,
		H List Box(
			self:Button Box( "OK", "run sql" )
		,
			Spacer Box( &amp;lt;&amp;lt;Set Auto Stretching( 1, 0 ) )
		,
			self:Button Box( "Cancel" )
		)
	)
);

self:finalize = Function( {},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	self:single select;
	1
);

self:single select = Function( {this = 0, index = 0},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	If( {self:DataParam 1, self:DataParam 2} &amp;lt;&amp;lt; Get( 1 ) == {1, 1},
		If( index == 1,
			self:DataParam 2 &amp;lt;&amp;lt; Set( 1, 0, Run Script( 1 ) )
		,
			self:DataParam 1 &amp;lt;&amp;lt; Set( 1, 0, Run Script( 1 ) )
		)
	,
		{self:DataParam 1, self:DataParam 2} &amp;lt;&amp;lt; Get( 1 ) == {0, 0},
		Try( this &amp;lt;&amp;lt; Set( 1, 1, Run Script( 1 ) ), self:DataParam 1 &amp;lt;&amp;lt; Set( 1, 1, Run Script( 1 ) ) );
	);
);

self:button box = Function( {name, callback = 1},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	Eval( Parse( Eval Insert( "\[
	box = Button Box( name, &amp;lt;&amp;lt;Set Function(
		Function( {this},
			{Default Local},
			self = Namespace( "^self &amp;lt;&amp;lt; Get Name^" );
			callback = "^callback^";
			If( callback != "1",
				Try( Eval( Parse( "self:" || callback ) ), Show( exception_msg ) )
			)
		)
	) )
	]\" ) ) );
);

self:combo box = Function( {values, name, callback = 1, default = 1},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	Eval( Parse( Eval Insert( "\[
	box = Combo Box( values, &amp;lt;&amp;lt;Set Function(
		Function( {this, index},
			{Default Local},
			self = Namespace( "^self &amp;lt;&amp;lt; Get Name^" );
			name = "^name^";
			callback = "^callback^";
			self:settings[name] = this &amp;lt;&amp;lt; Get Selected;
			If( callback != "1",
				Try( Eval( Parse( "self:" || callback ) ), Show( exception_msg ) )
			)
		)
	) )
	]\" ) ) );
	If( self:settings &amp;lt;&amp;lt; Contains( name ),
		index = Contains( values, self:settings[name] );
		box &amp;lt;&amp;lt; Set( index, 0 )
	,
		box &amp;lt;&amp;lt; Set( default, 0 )
	);
	box
);

self:check box = Function( {values, name, callback = 1, default = {}},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	Eval( Parse( Eval Insert( "\[
	box = Check Box( values, &amp;lt;&amp;lt;Set Function(
		Function( {this, index},
			{Default Local},
			self = Namespace( "^self &amp;lt;&amp;lt; Get Name^" );
			name = "^name^";
			callback = "^callback^";
			self:settings[name] = this &amp;lt;&amp;lt; Get Selected;
			If( callback != "1",
				Try( Eval( Parse( "self:" || callback ) ), Show( exception_msg ) )
			)
		)
	) )
	]\" ) ) );
	If( self:settings &amp;lt;&amp;lt; Contains( name ),
		N = N Items( self:settings[name] );
		vals = self:settings[name];
		For( i = 1, i &amp;lt;= N, i++,
			index = Contains( values, vals[i] );
			box &amp;lt;&amp;lt; Set( index, 1, 0 )
		)
	,
		N = N Items( default );
		For( i = 1, i &amp;lt;= N, i++,
			box &amp;lt;&amp;lt; Set( i, 1, 0 )
		);
	);
	box
);

self:destroy = Function( {},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	Save Text File( "$TEMP/SQL_Setup.jsl", Char( self:settings ) );
	1
);

self:run sql = Function( {},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	{company_1, company_2, product_1, product_2} = {self:company 1, self:company 2, self:product 1, self:product 2} &amp;lt;&amp;lt; Get Selected;
	program_1 = self:DataParam 1 &amp;lt;&amp;lt; Get( 1 );
	program_2 = self:DataParam 2 &amp;lt;&amp;lt; Get( 1 );
	code_1 = If( (Company_1 != "") &amp;amp; (Company_2 != ""),
		Eval Insert( "AND (COMPANY LIKE '%^Company_1^%' OR COMPANY LIKE '%^Company_2^%))" )
	,
		(Company_1 != ""),
		Eval Insert( "AND COMPANY LIKE '%^Company_1^%')" )
	);
		
	code_2 = If( (Product_1 != "") &amp;amp; (Product_2 != ""),
		Eval Insert( "AND (PRODUCT LIKE '%^Product_1^%' OR PRODUCT LIKE '%^Product_2^%))" )
	,
		(Product_1 != ""),
		Eval Insert( "AND PRODUCT LIKE '%^Product_1^%')" )
	);

	Show( code_1, code_2 );	
	//based on selected checkbox, run the query associated and insert code_1,code_2 at end of sql statement
	If(
		Program_1 != 0, self:SQL_Query_1( code_1, code_2 )
	,
		Program_2 != 0, self:SQL_Query_2( code_1, code_2 )
	);
);

self:SQL_Query_1 = Function( {code_1, code_2},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	sql_statement_1 = Eval Insert( "Select	*
    from TABLE.DATA
    WHERE SCANDATETIME &amp;gt; (SYSDATE - 30)" + code_1 + code_2 );
	Show( sql_statement_1 );
	Open Database( "DSN=xxx;UID=xxx;PWD=xxx;", sql_statement_1, "Table1" );
);

) );

Eval( Eval Expr(

self:initialize();
New Window( self:tool name,
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;On Close(
		self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
		Try( self:destroy );
		self &amp;lt;&amp;lt; Delete Namespace();
		1
	)
,
	&amp;lt;&amp;lt;On Open(
		self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
		self:window = Current Window();
		self:finalize();
		Print( self &amp;lt;&amp;lt; Get Name );
		1
	)
,
	self:content
);

) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Sep 2021 11:50:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/421991#M67097</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2021-09-29T11:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create UI to help build sql queries</title>
      <link>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422035#M67100</link>
      <description>&lt;P&gt;Thanks a million ErraticAttach&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i substitute back in some of my official information, i get a few error messages:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Upon hitting run and UI pops up, the embedded log displays:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The user-defined function "Button Box" conflicts with the JMP function "Button Box". Use a scoped reference (for example, Global:Button Box or Here:Button Box) to call your user-defined function. Other uses of "Button Box" in your script source will continue to call the JMP function.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;The user-defined function "Combo Box" conflicts with the JMP function "Combo Box". Use a scoped reference (for example, Global:Combo Box or Here:Combo Box) to call your user-defined function. Other uses of "Combo Box" in your script source will continue to call the JMP function.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;The user-defined function "Check Box" conflicts with the JMP function "Check Box". Use a scoped reference (for example, Global:Check Box or Here:Check Box) to call your user-defined function. Other uses of "Check Box" in your script source will continue to call the JMP function.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"#38"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Then i selected Program 1 and hit OK and i see:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;1st pop-up:&amp;nbsp; [Microsoft][ODBC Driver Manager] Invalid string or buffer length&lt;/P&gt;&lt;P&gt;2nd pop-up: Consult the log for the SQL statement that failed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Log reads:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;code_1 = "AND COMPANY LIKE '%AAA%')";&lt;BR /&gt;code_2 = "AND PRODUCT LIKE '%Prod1%')";&lt;BR /&gt;sql_statement_1 = "";&lt;/P&gt;&lt;P&gt;Invalid SQL statement:&lt;/P&gt;&lt;P&gt;{Button( 1 )}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on how to overcome this lack of an sql_statement?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 13:13:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422035#M67100</guid>
      <dc:creator>Tom_P</dc:creator>
      <dc:date>2021-09-29T13:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create UI to help build sql queries</title>
      <link>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422067#M67105</link>
      <description>&lt;P&gt;This approach is a bit simpler from a UI point of view.&amp;nbsp; Functions are useful but for this example I don't think you need them.&amp;nbsp; Here's the dialog box:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pmroz_0-1632925266241.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/36166i0E0ECDD97867CA59/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pmroz_0-1632925266241.png" alt="pmroz_0-1632925266241.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Note that the selection of which program to run is now a radio box.&amp;nbsp; So instead of choosing options for program 1 and options for program 2 it serves a more singular purpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;program_list = {"Option 1", "Option 2"};
company_list = {"AAA", "BBB", "CCC"};
product_list = {"Product 1", "Product 2"};

nw = new window("Option 1", &amp;lt;&amp;lt; modal,
	panel box("Select Program to run:",
		program_rb = radio box(program_list),
	),
	panel box("Select Company",
		hlistbox(
			comp_lb = list box(company_list),
			vlistbox(
				comp_right_bb = button box("", &amp;lt;&amp;lt; set icon("Next"),
					&amp;lt;&amp;lt; set function(
						function({this},
							comp_selected_lb &amp;lt;&amp;lt; append(comp_lb &amp;lt;&amp;lt; get selected);
						),
					),
				),
				comp_left_bb  = button box("", &amp;lt;&amp;lt; set icon("Prev"),
					&amp;lt;&amp;lt; set function(
						function({this},
							comp_selected_lb &amp;lt;&amp;lt; remove selected;
						),
					),
				),
			),
			comp_selected_lb = list box({}),
		),
	),
	panel box("Select Product",
		hlistbox(
			prod_lb = list box(product_list),
			vlistbox(
				prod_right_bb = button box("", &amp;lt;&amp;lt; set icon("Next"),
					&amp;lt;&amp;lt; set function(
						function({this},
							prod_selected_lb &amp;lt;&amp;lt; append(prod_lb &amp;lt;&amp;lt; get selected);
						),
					),
				),
				prod_left_bb  = button box("", &amp;lt;&amp;lt; set icon("Prev"),
					&amp;lt;&amp;lt; set function(
						function({this},
							prod_selected_lb &amp;lt;&amp;lt; remove selected;
						),
					),
				),
			),
			prod_selected_lb = list box({}),
		),
	),
	panel box("Actions",
		hlistbox(
			button box("OK", 
				continue_flag = 1;
				selected_company_list = comp_selected_lb &amp;lt;&amp;lt; get items;
				selected_product_list = prod_selected_lb &amp;lt;&amp;lt; get items;
			),
			button box("Cancel", continue_flag = 0),
		),
	),
);

if (continue_flag,
//	print(selected_company_list);
//	print(selected_product_list);

	company_sql = "";
	for (i = 1, i &amp;lt;= nitems(selected_company_list), i++,
		one_company = selected_company_list[i];
		if (i == 1,
			company_sql = evalinsert(" AND (COMPANY LIKE '%^one_company^%'");
			,
		// else
			company_sql = company_sql || evalinsert(" OR COMPANY LIKE '%^one_company^%'");
		);
	);
	company_sql = company_sql || ")";
//	print(company_sql);

	product_sql = "";
	for (i = 1, i &amp;lt;= nitems(selected_product_list), i++,
		one_product = selected_product_list[i];
		if (i == 1,
			product_sql = evalinsert(" AND (PRODUCT LIKE '%^one_product^%'");
			,
		// else
			product_sql = product_sql || evalinsert(" OR PRODUCT LIKE '%^one_product^%'");
		);
	);
	product_sql = product_sql || ")";
//	print(product_sql);

	sql_statement = Eval Insert( 
"Select *
   from TABLE.DATA
  WHERE SCANDATETIME &amp;gt; (SYSDATE - 30)
    ^company_sql^
    ^product_sql");
	print( sql_statement );
//	Open Database( "DSN=xxx;UID=xxx;PWD=xxx;", sql_statement_1, "Table1" );
);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Sep 2021 14:22:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422067#M67105</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2021-09-29T14:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create UI to help build sql queries</title>
      <link>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422116#M67113</link>
      <description>&lt;P&gt;I was using the functions as you'd defined them.&amp;nbsp; It looks like you need to concat the strings together by replacing line 195 with&amp;nbsp;&lt;CODE class=" language-jsl"&gt;WHERE SCANDATETIME &amp;gt; (SYSDATE - 30) " || code_1 || " " || code_2 );&lt;/CODE&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The popup happens because the database has phony values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The log about redefining the builtins happens because the function names mirror the builtins.&amp;nbsp; You can change the function names if you don't want the log messages.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 15:46:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422116#M67113</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2021-09-29T15:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create UI to help build sql queries</title>
      <link>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422177#M67120</link>
      <description>&lt;P&gt;Yes it now runs properly with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHERE SCANDATETIME &amp;gt; (SYSDATE - 365)" || "^code_1^" || "^code_2^"&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 17:27:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422177#M67120</guid>
      <dc:creator>Tom_P</dc:creator>
      <dc:date>2021-09-29T17:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create UI to help build sql queries</title>
      <link>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422184#M67125</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4550"&gt;@pmroz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate the help and very much like your idea as well&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i run the script as-is, the embedded log does not pick up on my selections and instead shows emptiness even though i made selections&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;"Select *
   from TABLE.DATA
  WHERE SCANDATETIME &amp;gt; (SYSDATE - 30)
    )
    )"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How can this be remedied?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 17:49:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422184#M67125</guid>
      <dc:creator>Tom_P</dc:creator>
      <dc:date>2021-09-29T17:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create UI to help build sql queries</title>
      <link>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422186#M67126</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4550"&gt;@pmroz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My apologies&lt;/P&gt;&lt;P&gt;This worked perfectly and i clicked on the selections but did not move them to the right sections to "choose" their value.&lt;/P&gt;&lt;P&gt;Sorry for the mixed message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another great solution!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 18:03:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-UI-to-help-build-sql-queries/m-p/422186#M67126</guid>
      <dc:creator>Tom_P</dc:creator>
      <dc:date>2021-09-29T18:03:25Z</dc:date>
    </item>
  </channel>
</rss>

