<?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: How do I pass in a variable number of variables to a function as an array? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-pass-in-a-variable-number-of-variables-to-a-function-as/m-p/810338#M99278</link>
    <description>&lt;P&gt;Are you looking for something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

get_summary = function({dt, collist}, {Default Local},
	dt_summary = dt &amp;lt;&amp;lt; Summary(
		Group(Eval(collist)),
		Freq("None"),
		Weight("None"),
		Link to original data table(0),
		output table name((dt &amp;lt;&amp;lt; get name) ||" Summary")
	);
	
	return(dt_summary);
);

dt_summary1 = get_summary(dt, {"sex"});
dt_summary2 = get_summary(dt, {"sex", "age"});&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Nov 2024 17:46:20 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-11-11T17:46:20Z</dc:date>
    <item>
      <title>How do I pass in a variable number of variables to a function as an array?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-pass-in-a-variable-number-of-variables-to-a-function-as/m-p/810336#M99276</link>
      <description>&lt;P&gt;I am hoping to make some functions I have a little more reusable as an example, I am creating a summary table with specific columns from my data set. I would like to pass in the columns list as an argument to allow me to have one "GetSummary" function rather than a "GetExperimentsSummary" and "GetCompoundsSummary" , but as these need different numbers of columns I need to be able to package the list of columns separately&amp;nbsp; (most likely in my class definition) and then pass them to the function as one argument. Is this possible in jsl? What would the syntax be? Examples of my get experiments and get compounds below, and I am on JMP18.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//Get Experiments function
getexperimentssummary = function ({}, 
	original_data &amp;lt;&amp;lt; Summary(
		Group(
			:ExperimentID, :Read Date, :Experiment Type, :Plate Size, :Plate Type,
			:Dispense Mode, :Probook Number, :Probook Page Number, :Experiment Notes
		),
		Freq( "None" ),
		Weight( "None" ),
		output table name("Experiment_summary")
	);
	experiment_summary = Data Table ("Experiment_summary");
    experiment_id = "ExperimentID";
);


//Get Compounds Summary 
getcompoundssummary = Function( {}, 
	original_data &amp;lt;&amp;lt; Summary(
		Group(
			:CompoundID, :Compound, :Compound Lot Number, :Compound Supplier, :Compound Catalog Number
		),
		Freq( "None" ),
		Weight( "None" ),
		output table name("Compound_summary")
	);
	compound_summary = Data Table ("Compound_summary");
    Compound_ID = "CompoundID";
);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 17:30:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-pass-in-a-variable-number-of-variables-to-a-function-as/m-p/810336#M99276</guid>
      <dc:creator>chappe</dc:creator>
      <dc:date>2024-11-11T17:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I pass in a variable number of variables to a function as an array?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-pass-in-a-variable-number-of-variables-to-a-function-as/m-p/810338#M99278</link>
      <description>&lt;P&gt;Are you looking for something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

get_summary = function({dt, collist}, {Default Local},
	dt_summary = dt &amp;lt;&amp;lt; Summary(
		Group(Eval(collist)),
		Freq("None"),
		Weight("None"),
		Link to original data table(0),
		output table name((dt &amp;lt;&amp;lt; get name) ||" Summary")
	);
	
	return(dt_summary);
);

dt_summary1 = get_summary(dt, {"sex"});
dt_summary2 = get_summary(dt, {"sex", "age"});&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Nov 2024 17:46:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-pass-in-a-variable-number-of-variables-to-a-function-as/m-p/810338#M99278</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-11-11T17:46:20Z</dc:date>
    </item>
  </channel>
</rss>

