<?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: Extract all desired elements from a string to enable multiple response analysis in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686714#M87236</link>
    <description>&lt;P&gt;Here is a potential solution that I came up with:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1697159508330.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57559i56F1FE12251E2F8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1697159508330.png" alt="txnelson_0-1697159508330.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here is the formula I used&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;i = 1;
string = "";
While( Word( i, :Input, "#;" ) != "",
	theWord = Word( i, :Input, "#;" );
	If( Is Missing( Num( theWord ) ) == 0,
		string = string || "," || theWord
	);
	i++;
);
Try( Substr( string, 2 ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 13 Oct 2023 01:12:35 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-10-13T01:12:35Z</dc:date>
    <item>
      <title>Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686698#M87235</link>
      <description>&lt;P&gt;Hi! I have data from a SharePoint which we use to (among other things) to track what tool/technique(s) was/were used to solve a problem. This includes JMP, BTW.&amp;nbsp; The data (in one column) follow this type of ;-delimited formatting:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;technique description&amp;gt;;#&amp;lt;technique ID&amp;gt;;&amp;lt;technique description&amp;gt;;#&amp;lt;technique ID&amp;gt;;&amp;lt;technique description&amp;gt;;#&amp;lt;technique ID&amp;gt;...&lt;/P&gt;&lt;P&gt;3.4 Offline Optimization &amp;amp; Simulation Tools;#15;#3.9 Simulation;#30;#4.6 Material Balance;#22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each row in the table (problem solved) can have one or more &amp;lt;technique ID&amp;gt;. Sometimes the &amp;lt;description&amp;gt; starts with #, sometimes not. But &amp;lt;technique ID&amp;gt; is always preceded by #.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to parse the string for the &amp;lt;technique ID&amp;gt;'s&amp;nbsp; and format for Multiple Response analysis: 15, 30, 22 (above example).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;There are ~100 &amp;lt;technique ID&amp;gt;, so creating ~100 sparse columns seems wasteful.&amp;nbsp; Is the approach used in the Sample Data file Failures3Delimited.jmp the most efficient way to approach this problem?&lt;/LI&gt;&lt;LI&gt;I've started to learn REGEX and have been able to find one occurrence of &amp;lt;technique ID&amp;gt;, but not all. Do I need a loop? Some other way to do this?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thanks. Using JMP17.1 Pro.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 00:26:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686698#M87235</guid>
      <dc:creator>markschahl</dc:creator>
      <dc:date>2023-10-13T00:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686714#M87236</link>
      <description>&lt;P&gt;Here is a potential solution that I came up with:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1697159508330.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57559i56F1FE12251E2F8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1697159508330.png" alt="txnelson_0-1697159508330.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here is the formula I used&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;i = 1;
string = "";
While( Word( i, :Input, "#;" ) != "",
	theWord = Word( i, :Input, "#;" );
	If( Is Missing( Num( theWord ) ) == 0,
		string = string || "," || theWord
	);
	i++;
);
Try( Substr( string, 2 ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2023 01:12:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686714#M87236</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-10-13T01:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686721#M87237</link>
      <description>&lt;P&gt;Very elegant - instead of a complicated split first-second (twice the same delimiter) or some which part is the TEXT, just:&lt;/P&gt;&lt;P&gt;find the NUMBERS :)&lt;/img&gt;&lt;BR /&gt;&lt;BR /&gt;Let's hope there is no ID #30-2&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;or a description: 42&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "IDs",
	Character,
	"Multiple Response",
	Formula(
		Concat Items(
			Transform Each( {theWord}, Words( :Input, ";#" ),
				Char( Num( theWord ) )
			),
			""
		)
	),
	Set Property( "Multiple Response", Multiple Response( Separator( "." ) ) ),
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 04:58:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686721#M87237</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-10-13T04:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686743#M87241</link>
      <description>&lt;P&gt;Won't go suggesting using &lt;A href="https://www.jmp.com/support/help/en/17.2/index.shtml#page/jmp/pattern-matching.shtml#ww447620" target="_blank" rel="noopener"&gt;JMP's Character Pattern&lt;/A&gt; as it is fairly difficult to understand (at least all the different functionalities) but I did manage (maybe) to do this using it&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

str = "3.4 Offline Optimization &amp;amp; Simulation Tools;#15;#3.9 Simulation;#30;#4.6 Material Balance;#22";

idlist2 = {};
resval = "";
Pat Match(str, Pat Span("#") + Pat Regex("\d+?") &amp;gt;&amp;gt; next_id + Pat Regex("(;|$)") + Pat Test(
	Insert Into(idlist2, next_id); resval = Concat Items(idlist2, ", "))
);
show(idlist2, resval);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;here is example using it in formula&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(1),
	Compress File When Saved(1),
	New Column("Column 1",
		Character,
		"Nominal",
		Set Values(
			{
			"3.4 Offline Optimization &amp;amp; Simulation Tools;#15;#3.9 Simulation;#30;#4.6 Material Balance;#22"
			}
		)
	),
	New Column("Column 2",
		Character,
		"Multiple Response",
		Formula(
			idlist2 = {};
			resval = "";
			Pat Match(
				:Column 1,
				Pat Span("#") + Pat Immediate(Pat Regex("\d+?"), next_id)
				+Pat Regex("(;|$)") + Pat Test(
					Insert Into(idlist2, next_id);
					resval = Concat Items(idlist2, ", ");
				)
			);
			resval;
		),
		Set Property("Multiple Response", Multiple Response(Separator(",")))
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2023 05:22:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686743#M87241</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-13T05:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686752#M87242</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;... complicated split first-second ...&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;actually -&amp;nbsp; less complicated than I thought :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "IDs",
	Character,
	"Multiple Response",
	Formula(
		splitItems = Words( :Input, ";#" );
		Concat Items( splitItems[2:: N Items( splitItems ):: 2], "," );
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... and one of the next versions of Jmp will make it even easier:&lt;BR /&gt;&lt;A href="https://community.jmp.com/t5/JMP-Wish-List/new-slicing-options-for-matrices/idc-p/614326/highlight/true#M4057" target="_blank" rel="noopener"&gt;https://community.jmp.com/t5/JMP-Wish-List/new-slicing-options-for-matrices/idc-p/614326/highlight/true#M4057&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 08:45:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686752#M87242</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-10-13T08:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686871#M87247</link>
      <description>&lt;P&gt;Thanks, Jim! I was thinking that some sort of loop would do the trick, with or without REGEX. Hope that you are well!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 08:13:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686871#M87247</guid>
      <dc:creator>markschahl</dc:creator>
      <dc:date>2023-10-13T08:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686874#M87248</link>
      <description>&lt;P&gt;Jarmo: Thanks for your effort! I read the REGEX and Pat Match sections in the Scripting Manual and decided to not try Pat Match unless absolutely necessary...&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 08:14:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686874#M87248</guid>
      <dc:creator>markschahl</dc:creator>
      <dc:date>2023-10-13T08:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686885#M87250</link>
      <description>&lt;P&gt;hogi: Thanks for both your submissions! I'd used Words() before, but didn't think of it because early on I convinced myself that I would have to pursue a REGEX solution. This solution is very elegant! I need to read up on Concat Items()...&lt;BR /&gt;&lt;BR /&gt;Jim/Jarmo/hogi: you have showed the global power of the community! I now sit in Kuala Lumpur. I posted this first thing my morning when you were likely about to sleep/already sleeping. I got a solution from you by my late afternoon. Thank you again!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 08:22:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/686885#M87250</guid>
      <dc:creator>markschahl</dc:creator>
      <dc:date>2023-10-13T08:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/687105#M87268</link>
      <description>&lt;P&gt;The necessary change is the current delimiter to one JMP recognizes as multiple responses. The Substitute function would also work well in this case.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 18:41:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/687105#M87268</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-10-13T18:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Extract all desired elements from a string to enable multiple response analysis</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/687146#M87271</link>
      <description>&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 19:59:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-all-desired-elements-from-a-string-to-enable-multiple/m-p/687146#M87271</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-10-13T19:59:37Z</dc:date>
    </item>
  </channel>
</rss>

