<?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 How to loop through rows of data table based on user input with wild card in order to load data from database for each selected row item in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-loop-through-rows-of-data-table-based-on-user-input-with/m-p/637411#M83515</link>
    <description>&lt;P&gt;I have a data table with first column filled with part_IDs (other columns have got other info about corresponding to each part) and a working function which loads test data for a given (single) part_ID from the database.&amp;nbsp; I would like to have the following functionality via a modal window.&lt;/P&gt;&lt;P&gt;1. Have the user select the part_IDs in the data table using a wild card. For example, the part_IDs are of the form- A0012, A0013, A0014 and so on and then B7001,&amp;nbsp;B7002,&amp;nbsp;B7003 and so on. The user needs to be able to just specify something like A00* or B70* and select the corresponding part_IDs in the data table where * is the wild card character.&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Once the part_IDs are selected, I would like to loop through each of them and get the test data via my function (which takes the part_ID as input and returns the test data in a data table) and then concatenate each new data table below the previous to get a final data table (note all test data table have identical column names)&lt;/P&gt;&lt;P&gt;How to implement this in JSL?&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 16:11:04 GMT</pubDate>
    <dc:creator>Neo</dc:creator>
    <dc:date>2023-06-09T16:11:04Z</dc:date>
    <item>
      <title>How to loop through rows of data table based on user input with wild card in order to load data from database for each selected row item</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-loop-through-rows-of-data-table-based-on-user-input-with/m-p/637411#M83515</link>
      <description>&lt;P&gt;I have a data table with first column filled with part_IDs (other columns have got other info about corresponding to each part) and a working function which loads test data for a given (single) part_ID from the database.&amp;nbsp; I would like to have the following functionality via a modal window.&lt;/P&gt;&lt;P&gt;1. Have the user select the part_IDs in the data table using a wild card. For example, the part_IDs are of the form- A0012, A0013, A0014 and so on and then B7001,&amp;nbsp;B7002,&amp;nbsp;B7003 and so on. The user needs to be able to just specify something like A00* or B70* and select the corresponding part_IDs in the data table where * is the wild card character.&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Once the part_IDs are selected, I would like to loop through each of them and get the test data via my function (which takes the part_ID as input and returns the test data in a data table) and then concatenate each new data table below the previous to get a final data table (note all test data table have identical column names)&lt;/P&gt;&lt;P&gt;How to implement this in JSL?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:11:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-loop-through-rows-of-data-table-based-on-user-input-with/m-p/637411#M83515</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-06-09T16:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to loop through rows of data table based on user input with wild card in order to load data from database for each selected row item</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-loop-through-rows-of-data-table-based-on-user-input-with/m-p/637421#M83517</link>
      <description>&lt;P&gt;For part one this might get you started&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(6),
	Compress File When Saved(1),
	New Column("ID",
		Character,
		"Nominal",
		Set Values({"A001", "A002", "A003", "B001", "B002", "B003"})
	)
);

nw = New Window("", &amp;lt;&amp;lt; modal, &amp;lt;&amp;lt; return result,
	v list box(
		teb = text edit box("A00*"),
		h list box(
			Button Box("OK"),
			Button Box("Cancel"),
		)
	)
);

If(nw["Button"] != 1,
	stop();
);

// no real idea behind the selection logic, so we will use very simple one
// user has to always provide *
user_input = nw["teb"];
If(!Contains(user_input, "*"),
	Throw("No wild card provided!");
);

user_rows = dt &amp;lt;&amp;lt; Get Rows Where(Starts With(:ID, Substitute(nw["teb"], "*", "")));
user_ids = dt[user_rows, "ID"];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Concatenation is easy to do by letting JMP create script for it. Then just add references and maybe make it into a function&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2023 14:47:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-loop-through-rows-of-data-table-based-on-user-input-with/m-p/637421#M83517</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-05-31T14:47:28Z</dc:date>
    </item>
  </channel>
</rss>

