In the Text Explorer window you can right click a phrase which will select the rows in the database. How would I script this feature? What I would like to do is select the top three phrases in the Text Explorer window in order to subset the table.
Probably should have read the whole question first.
Names Default to here(1); dt = open("$SAMPLE_DATA\Aircraft Incidents.jmp"); te = dt << Text Explorer( Text Columns( :Final Narrative ), Set Regex( Library( "Domain names" ), Library( "Money" ), Library( "Words" ), Library( "HTML Link Grabber" ), Library( "\[Bang!!! cleaner]\" ), Library( "Time" ), Library( "Numbers" ) ), Language( "English" ) ); rep = te << report; scb = (rep << xpath("//StringColBoxHeader[text()='Phrase']/.."))[1]; // finds the phrase string col box items = scb << Get; // gets the values for(i=1, i<=3, i++, dt << Select Where(Contains(:Final Narrative, items[i]), current selection("extend")); );
Hopefully that works for you.
Vince, thanks for the reply... it seems to work at times but the contains function is case sensitive. I tried to force the items to lowercase but they still do not get selected when they are mixed with upper and lower case.
lowercase(items[1]); lowercase(items[2]); lowercase(items[3]); for(i=1, i<=3, i++, dt1 << Select Where(contains(:DISPO TEXT, items[i]), current selection("extend")); );
Any ideas?
Also lowercase the :Dispo Text, the items are probably already lowercase.
dt1 <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> Select Where<SPAN class="token punctuation">(</SPAN><SPAN class="token function">contains</SPAN><SPAN class="token punctuation">(lowercase(</SPAN><SPAN class="token punctuation">:</SPAN>DISPO <SPAN class="token function">TEXT)</SPAN><SPAN class="token punctuation">,</SPAN> items<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> current selection<SPAN class="token punctuation">(</SPAN><SPAN class="token string">"extend"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
Thank you! That worked like a charm.