<?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: Use JSL to set different formula in each row in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720517#M90275</link>
    <description>&lt;P&gt;Thank you Jim, a slider box is what I'm looking for.&lt;/P&gt;&lt;P&gt;But one more thing, I&amp;nbsp;create a buttom box to get the value from slider box then set each value to change rows, is it possible to make the row real time change as the slider, without additional check buttom?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Value = 0;
New Window( "Example",
	Panel Box( "Parameter setting",
		tb = Text Box( "Parameter A: " || Char( Value ) ),
		sb = Slider Box( 0, 1, Value, tb &amp;lt;&amp;lt; Set Text( "Value: " || Char( Value ) ) ),
		Button Box( "OK",
		:Parameter A &amp;lt;&amp;lt; set each value(Value)
		)	
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2024 02:10:03 GMT</pubDate>
    <dc:creator>BayesRabbit7133</dc:creator>
    <dc:date>2024-01-31T02:10:03Z</dc:date>
    <item>
      <title>Use JSL to set different formula in each row</title>
      <link>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/719808#M90219</link>
      <description>&lt;P&gt;Hi JMP experts,&lt;/P&gt;&lt;P&gt;Somehow I think my post just got deleted, post it again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a DOE table with many predicted formula, these formulae have X, Y axis relationship&lt;/P&gt;&lt;P&gt;I would like to rearrange data table into below format so that I can draw surface plot (X, Y, Value) to see how it changes as&amp;nbsp; I change parameter&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BayesRabbit7133_0-1706604162914.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60705i42230ADD340BA242/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BayesRabbit7133_0-1706604162914.png" alt="BayesRabbit7133_0-1706604162914.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Two issues:&lt;/P&gt;&lt;P&gt;1. I can get formulae then concate to below format if ( row == 1, formula 1, if( row == 2, formula 2, ......etc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;But eventually the formula is a long char with "", I need to manully remove "' for the formula to work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. I use H list box to get value and set each row to change parameters, so that I can see how surface plot changes. But ideally I would like to use scorll bar to change the parameter so that I can see the changes more smoothly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = data table("example DOE table");
dt2 = current data table();
colname = dt &amp;lt;&amp;lt; get column names();
colnamelist = {};
formulalist = {};
loopword = char("If( Row() == ");
mid = char("");
final = char("");

//Get column names with predicted formula
for (i = 1, i &amp;lt;= N items(colname),i++,
	pos = Contains (colname[i], "Pred F");
	if(pos == 1 , insert into(colnamelist, colname[i]), continue())
);

//Get formula from columns and save into list
for each({colval}, colnamelist,
	eval(evalexpr(
		formula  = Char(Expr(Name Expr(As Column(dt,colval))) &amp;lt;&amp;lt; get formula());		
	));
	insert into (formulalist, formula)
);

//Concat formulas to below format: If( row == 1, Formula 1, If( row ==2, Forumla 2, If( row == 3, formula 3)))......etc
for (i=1, i &amp;lt;= N rows() , i++,
	mid = mid || loopword || char(i) || ", " || char(formulalist[i]) || ", "	
);

final = mid || char("0");

for (i=1, i &amp;lt;= N rows() , i++,
	final = final || char(")")
);

eval(evalexpr(
	:height &amp;lt;&amp;lt; set formula(expr(final))
));

nw = New Window( "process paramaeter setting",
	H List Box( Text Box( "   Input Parameter A " ), A = Number Edit Box() ),
	H List Box( Text Box( "   Input Parameter B " ), B = Number Edit Box() ),
	H List Box( Text Box( "   Input Parameter C " ), C = Number Edit Box() ),
	H List Box( Text Box( "   Input Parameter D " ), D = Number Edit Box() ),
	Button Box( "OK",
		theA = A &amp;lt;&amp;lt; get;
		theB = B &amp;lt;&amp;lt; get;
		theC = C &amp;lt;&amp;lt; get;
		theD = D &amp;lt;&amp;lt; get;

		:Parameter A &amp;lt;&amp;lt; set each value(theA);
		:Parameter B &amp;lt;&amp;lt; set each value(theB);
		:Parameter C &amp;lt;&amp;lt; set each value(theC);
		:Parameter D &amp;lt;&amp;lt; set each value(theD);
	    //Somehow the column with formula cannot draw into surface plot directly, so I have to copy and paste value to anohter column to draw
		newheight = :height &amp;lt;&amp;lt; get values;
		:newheight&amp;lt;&amp;lt; set values(newheight);
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 08:49:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/719808#M90219</guid>
      <dc:creator>BayesRabbit7133</dc:creator>
      <dc:date>2024-01-30T08:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Use JSL to set different formula in each row</title>
      <link>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720028#M90226</link>
      <description>&lt;P&gt;I found it, a simple parse() can do the trick for my first question&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;seval(evalexpr(
	:height &amp;lt;&amp;lt; set formula(expr(parse(final)))
));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But for the second question, it would be really nice if we can have scroll bar to set each value&amp;nbsp; so that user can easily review how 3D map changes as the parameter changes,&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 14:33:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720028#M90226</guid>
      <dc:creator>BayesRabbit7133</dc:creator>
      <dc:date>2024-01-30T14:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Use JSL to set different formula in each row</title>
      <link>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720110#M90230</link>
      <description>&lt;P&gt;It sounds like you need to use Slider Boxes for your input, rather than the Number Edit Boxes&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 15:23:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720110#M90230</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-01-30T15:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Use JSL to set different formula in each row</title>
      <link>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720517#M90275</link>
      <description>&lt;P&gt;Thank you Jim, a slider box is what I'm looking for.&lt;/P&gt;&lt;P&gt;But one more thing, I&amp;nbsp;create a buttom box to get the value from slider box then set each value to change rows, is it possible to make the row real time change as the slider, without additional check buttom?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Value = 0;
New Window( "Example",
	Panel Box( "Parameter setting",
		tb = Text Box( "Parameter A: " || Char( Value ) ),
		sb = Slider Box( 0, 1, Value, tb &amp;lt;&amp;lt; Set Text( "Value: " || Char( Value ) ) ),
		Button Box( "OK",
		:Parameter A &amp;lt;&amp;lt; set each value(Value)
		)	
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 02:10:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720517#M90275</guid>
      <dc:creator>BayesRabbit7133</dc:creator>
      <dc:date>2024-01-31T02:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Use JSL to set different formula in each row</title>
      <link>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720527#M90276</link>
      <description>&lt;P&gt;look in the Scripting Index for the Slider Box() and you will see:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Syntax:&amp;nbsp;&lt;/STRONG&gt;box = Slider Box(min Value, max Value, variable,&amp;nbsp;&lt;STRONG&gt;SCRIPT&lt;/STRONG&gt;, &amp;lt;set width(n)&amp;gt;, &amp;lt;rescale slider(min Value, max Value)&amp;lt; )&lt;/P&gt;
&lt;P&gt;You can take the JSL from your OK button and place it into the definition of the Slider Box().&amp;nbsp; It will be executed every time the slider is moved.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 02:18:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720527#M90276</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-01-31T02:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Use JSL to set different formula in each row</title>
      <link>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720558#M90279</link>
      <description>&lt;P&gt;This perfectly resolved my issue, thank you Jim for your support&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 03:21:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-JSL-to-set-different-formula-in-each-row/m-p/720558#M90279</guid>
      <dc:creator>BayesRabbit7133</dc:creator>
      <dc:date>2024-01-31T03:21:35Z</dc:date>
    </item>
  </channel>
</rss>

