<?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: storing variable from file and using for max function in jsl scripting in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594626#M79848</link>
    <description>&lt;P&gt;I have taken a second look at your latest post, and I believe that I have a new script that will take care of the complex name issue that you exposed in that post.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// The code below this line is the that does the calculations  The code above this line would
// not normally be included
Names Default To Here( 1 ); 

// point to the large data table with lots of rows and columns
dt = Data Table( "Main" );
// If you are opening the table from a folder, this statement would be
//  dt = open("the path to the table");

// point to the second data table that contains a list of columns to be summed
dtMax = Data Table( "config" );
// If you are opening the table from a folder, this statement would be
//  dtMax = open("the path to the table");

// Just added a short pause so one can see the original tables before changing 

// Create the new columns
For( i = 1, i &amp;lt;= N Cols( dtMax ), i++,
	sumList = Column( dtMax, i ) &amp;lt;&amp;lt; get values;
	dt &amp;lt;&amp;lt; New Column( Column( dtMax, i ) &amp;lt;&amp;lt; get name );
	nameList = ":\!"" || sumList[1] || "\!"n";
	For( k = 2, k &amp;lt;= N Rows( dtMax ), k++,
		Insert Into( nameList, ", :\!"" || sumList[k] || "\!"n" )
	);
	Column( dt, N Cols( dt ) ) &amp;lt;&amp;lt; set formula( Eval( Parse( "max(" || nameList || ")" ) ) );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 29 Jan 2023 14:04:40 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-01-29T14:04:40Z</dc:date>
    <item>
      <title>storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594422#M79819</link>
      <description>&lt;P&gt;hello members ,&lt;/P&gt;&lt;P&gt;am a new user just begin JSL scripting , could you provide a suggestion how to execute below need&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have 2 files ,&amp;nbsp;&lt;BR /&gt;File1 : contains data with thousands of&amp;nbsp;columns (string) and row (numbers)&lt;/P&gt;&lt;P&gt;File2 : contains few list of columns which i created manually to pick interested column from file1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my need is to do max function based on list from file 2 and create new column in file 1&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is code which i tried and didnt work as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dt = Open ("C:/File2.csv")&lt;/P&gt;&lt;P&gt;list = dt &amp;lt;&amp;lt; get name; // list&amp;nbsp; = is basically few random column names from file1 = row 1 ,row2,row10, etc&amp;nbsp;&lt;/P&gt;&lt;P&gt;dt1 = Open ("C:/File1.jmp")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New column ( "max list",Numeric,Formula (Max (list)));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:40:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594422#M79819</guid>
      <dc:creator>cms</dc:creator>
      <dc:date>2023-06-08T16:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594435#M79820</link>
      <description>&lt;P&gt;Not sure how your data looks like, but here is one suggestion. Not the most simple looking solution and requires JMP16+&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("File2",
	Add Rows(0),
	Compress File When Saved(1),
	New Column("Column 1", Character, "Nominal", Format("Best", 12), Set Values({"Column 1", "Column 2"}))
);

dt1 = New Table("File1",
	Add Rows(3),
	Compress File When Saved(1),
	New Column("Column 1", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 1])),
	New Column("Column 2", Numeric, "Continuous", Format("Best", 12), Set Values([2, 2, 2])),
	New Column("Column 3", Numeric, "Continuous", Format("Best", 12), Set Values([3, 3, 3]))
);

Show(dt &amp;lt;&amp;lt; Get Name); // this will get name of the datatable not columns

max_list = Column(dt, "Column 1") &amp;lt;&amp;lt; get values;
expr_max = Expr(Max());

For Each({col}, max_list,
	Insert Into(expr_max, NameExpr(AsColumn(Column(dt1, col))))
);
Show(NameExpr(expr_max));
Eval(EvalExpr(
	dt1 &amp;lt;&amp;lt; New Column("MaxList", Numeric, Continuous, Formula(
		Expr(NameExpr(expr_max))
	));	
));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;LI-MESSAGE title="Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute" uid="48998" url="https://community.jmp.com/t5/JSL-Cookbook-Archived/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/m-p/48998#U48998" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt; for a good read&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jan 2023 15:25:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594435#M79820</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-01-28T15:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594468#M79825</link>
      <description>&lt;P&gt;Here is a simple example that takes a large main table and uses lists from a second data table to create new columns in the main table that are the summation of the columns referenced in the second table.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Open the large data table with lots of rows and columns
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

// Create a second data table that contains a list of columns to be summed
dtSum = New Table( "Columns List",
	New Column( "Summ1", character, values( {"NPN1", "NPN2", "NPN3"} ) ),
	New Column( "Summ2", character, values( {"PNP1", "PNP2", "PNP3", "PNP4"} ) )
);
Wait(5);  // Just added a short pause so one can see the original tables before changing 

// Create the new columns
For( i = 1, i &amp;lt;= N Cols( dtSum ), i++,
	sumList = Column( dtSum, i ) &amp;lt;&amp;lt; get values;
	dt &amp;lt;&amp;lt; New Column( Column( dtSum, i ) &amp;lt;&amp;lt; get name );
	Column( dt, N Cols( dt ) ) &amp;lt;&amp;lt; set formula(
		Eval( Parse( "sum(" || Concat Items( sumList, "," ) || ")" ) )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Jan 2023 19:29:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594468#M79825</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-01-28T19:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594526#M79830</link>
      <description>&lt;P&gt;thanks for suggestion ,my requirement is different&amp;nbsp;&lt;/P&gt;&lt;P&gt;file1 looks like this ( this is my main table where i would like to find max values from office1,2,4)&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;office1&lt;/TD&gt;&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ist (values from office1,2,4)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;simple solution : New Column("MaxList", Numeric, Continuous, Formula(Max(:"office1",:"office2,:"office4")));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;office1&lt;/TD&gt;&lt;TD&gt;office2&lt;/TD&gt;&lt;TD&gt;office3&lt;/TD&gt;&lt;TD&gt;office4&lt;/TD&gt;&lt;TD&gt;office 5&lt;/TD&gt;&lt;TD&gt;..&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Maxlist&amp;nbsp;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;T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&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;file2:&amp;nbsp; &amp;nbsp;list of column name given as input parameter and execute the script&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;office1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;office2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;office4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;looking for solution where i can give max list in file2 and execute in file1&lt;/P&gt;&lt;P&gt;New Column("MaxList", Numeric, Continuous, Formula(Max(&lt;STRONG&gt;Based&lt;/STRONG&gt; &lt;STRONG&gt;on&amp;nbsp;file2 list&lt;/STRONG&gt;")));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 04:27:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594526#M79830</guid>
      <dc:creator>cms</dc:creator>
      <dc:date>2023-01-29T04:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594527#M79831</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for suggestion ,it didnt work as expected i might be doing something wrong. to be more clear i have provided how the file looks and requirement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;file1 looks like this ( this is my main table where i would like to find max values from office1,2,4)&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;office1&lt;/TD&gt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xlist (values from office1,2,4)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;simple solution : New Column("MaxList", Numeric, Continuous, Formula(Max(:"office1",:"office2,:"office4")));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;office1&lt;/TD&gt;&lt;TD&gt;office2&lt;/TD&gt;&lt;TD&gt;office3&lt;/TD&gt;&lt;TD&gt;office4&lt;/TD&gt;&lt;TD&gt;office 5&lt;/TD&gt;&lt;TD&gt;..&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Maxlist&amp;nbsp;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;file2:&amp;nbsp; &amp;nbsp;list of column name given as input parameter and execute the script&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;office1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;office2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;office4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;looking for solution where i can give max list in file2 and execute in file1&lt;/P&gt;&lt;P&gt;New Column("MaxList", Numeric, Continuous, Formula(Max(&lt;STRONG&gt;Based&lt;/STRONG&gt; &lt;STRONG&gt;on&amp;nbsp;file2 list&lt;/STRONG&gt;")));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 04:29:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594527#M79831</guid>
      <dc:creator>cms</dc:creator>
      <dc:date>2023-01-29T04:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594535#M79833</link>
      <description>&lt;P&gt;The code I previously provided, did exactly what you want, with one exception.&amp;nbsp; Instead of providing the Max value, it provided the Sum of the columns specified.&amp;nbsp; I have reworked the script, and changed from the Sum to the Max.&amp;nbsp; I am also using your example data tables.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1674973963754.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/49580iE6B57B8CCE229175/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1674973963754.png" alt="txnelson_0-1674973963754.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;My code uses the name from column in file2, as the name to be used for the new column added in the main data table.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_1-1674974142812.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/49581i29367EBC4297CC9E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_1-1674974142812.png" alt="txnelson_1-1674974142812.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I did this because the code allows you to specify more than one list in file2.&amp;nbsp; So that if your file2 looked like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_2-1674974400220.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/49582i61E60011988FF061/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_2-1674974400220.png" alt="txnelson_2-1674974400220.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It would give you the following results&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_3-1674974445450.png" style="width: 511px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/49583iC8243F3D9027EDA4/image-dimensions/511x212?v=v2" width="511" height="212" role="button" title="txnelson_3-1674974445450.png" alt="txnelson_3-1674974445450.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Create the sample data tables
New Table( "Main",
	Add Rows( 5 ),
	New Column( "office1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [2, 3, 2, 1, 4] )
	),
	New Column( "office2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [3, 2, 5, 0, 1] )
	),
	New Column( "office3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [0, 6, 3, 2, 2] )
	),
	New Column( "office4",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [6, 4, 2, 3, 7] )
	),
	New Column( "office 5",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 4, 3, 2, 1] )
	)
);
New Table( "Config",
	Add Rows( 3 ),
	New Column( "Maxlist",
		Character,
		"Nominal",
		Set Values( {"office1", "office2", "office4"} )
	)
);

wait(5);  // I put in a wait just so you can see the 2 tables


// The code below this line is the that does the calculations  The code above this line would
// not normally be included
Names default to here(1); 

// point to the large data table with lots of rows and columns
dt = data table("Main");
// If you are opening the table from a folder, this statement would be
//  dt = open("the path to the table");

// point to the second data table that contains a list of columns to be summed
dtMax = data table("config");
// If you are opening the table from a folder, this statement would be
//  dtMax = open("the path to the table");

  // Just added a short pause so one can see the original tables before changing 

// Create the new columns
For( i = 1, i &amp;lt;= N Cols( dtMax ), i++,
	sumList = Column( dtMax, i ) &amp;lt;&amp;lt; get values;
	dt &amp;lt;&amp;lt; New Column( Column( dtMax, i ) &amp;lt;&amp;lt; get name );
	Column( dt, N Cols( dt ) ) &amp;lt;&amp;lt; set formula(
		Eval( Parse( "max(" || Concat Items( sumList, "," ) || ")" ) )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 06:41:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594535#M79833</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-01-29T06:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594551#M79835</link>
      <description>&lt;P&gt;thank you very much&amp;nbsp;&lt;SPAN&gt;txnelson ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;it worked . was doing a simple mistake of not using the column name&amp;nbsp; Maxlist in file2&lt;/P&gt;&lt;P&gt;But i got another error : The namespace " office1.close:today " is not defined&amp;nbsp; returns the maximum value among the argument or of the values within in the single matrix of list argument&amp;nbsp;&lt;/P&gt;&lt;P&gt;" office1.close:today "is one of the file2&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i open file1 maxlist column and click edit formula the error goes off.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 07:56:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594551#M79835</guid>
      <dc:creator>cms</dc:creator>
      <dc:date>2023-01-29T07:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594555#M79837</link>
      <description>&lt;P&gt;Get rid of the period and colon and just use the name&lt;/P&gt;
&lt;P&gt;office1 close today&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 08:21:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594555#M79837</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-01-29T08:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594573#M79839</link>
      <description>Could you recommend a solution which can include colon and period. As parameter list contains space colon which cannot be modified</description>
      <pubDate>Sun, 29 Jan 2023 09:16:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594573#M79839</guid>
      <dc:creator>cms</dc:creator>
      <dc:date>2023-01-29T09:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594583#M79842</link>
      <description>&lt;P&gt;Please attach an example data table and parameter list, and I will take a look at a solution&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 10:40:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594583#M79842</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-01-29T10:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594626#M79848</link>
      <description>&lt;P&gt;I have taken a second look at your latest post, and I believe that I have a new script that will take care of the complex name issue that you exposed in that post.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// The code below this line is the that does the calculations  The code above this line would
// not normally be included
Names Default To Here( 1 ); 

// point to the large data table with lots of rows and columns
dt = Data Table( "Main" );
// If you are opening the table from a folder, this statement would be
//  dt = open("the path to the table");

// point to the second data table that contains a list of columns to be summed
dtMax = Data Table( "config" );
// If you are opening the table from a folder, this statement would be
//  dtMax = open("the path to the table");

// Just added a short pause so one can see the original tables before changing 

// Create the new columns
For( i = 1, i &amp;lt;= N Cols( dtMax ), i++,
	sumList = Column( dtMax, i ) &amp;lt;&amp;lt; get values;
	dt &amp;lt;&amp;lt; New Column( Column( dtMax, i ) &amp;lt;&amp;lt; get name );
	nameList = ":\!"" || sumList[1] || "\!"n";
	For( k = 2, k &amp;lt;= N Rows( dtMax ), k++,
		Insert Into( nameList, ", :\!"" || sumList[k] || "\!"n" )
	);
	Column( dt, N Cols( dt ) ) &amp;lt;&amp;lt; set formula( Eval( Parse( "max(" || nameList || ")" ) ) );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 29 Jan 2023 14:04:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594626#M79848</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-01-29T14:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: storing variable from file and using for max function in jsl scripting</title>
      <link>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594633#M79851</link>
      <description>&lt;P&gt;thank you .appreciate your help. it worked and resolved period /colon space issue.&lt;/P&gt;&lt;P&gt;Found another issue if max list and max list1 are not same counts of rows it gives error due to last row being empty in maxlist1.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Maxlist&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Maxlist1&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;office1.close:today&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;office2.close:today&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;office2.close:today&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;office3.close:today&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;office3.close:today&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 29 Jan 2023 15:23:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/storing-variable-from-file-and-using-for-max-function-in-jsl/m-p/594633#M79851</guid>
      <dc:creator>cms</dc:creator>
      <dc:date>2023-01-29T15:23:45Z</dc:date>
    </item>
  </channel>
</rss>

