cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Jackie_
Level VI

extract a particular sting

Hi, 

 

I want to extract the bin values from the rows and store in the list.

 

For example- 

BIN = "B" 8 "Bad Bump" -> I want to extract letter "B" from the string  and store in the list

BIN = "P" 6153 "PCM"  -> I want to extract letter "P" from the string and store in the list and likewise for all the rows containing bin

 

Here is what I tried so far. It only extracts the row 13

Names Default To Here( 1 );
Clear Globals();
Clear Log();

dt = current data table();
asa = dt << Get Rows Where (Contains(as column(3), "BIN") & Contains(as column(3), "NULL") == 0);

binlist = {};
startrownumber= asa[1];


for(k =1, k<= Nitems(asa), k++,

Insertinto(binlist, db_test:Bins[asa])
	
	
);
binvaluelist= {};


 for (i = startrownumber, i <= nitems(asa), i++,

	newlist = dt:Bins[i];
	
	word_list = words(newlist, "\!"\!"");
insertinto(binvaluelist, word_list);
	
);

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: extract a particular sting

If this is related to text parsing from Import x and y values from the text file to jmp table and create wafer map I would use different approach. But let's assume that we start with the existing data table.

 

I would most likely use Regex if the pattern stays always the same:

Names Default To Here(1);

dt = Open("$DOWNLOADS/Bin table.jmp");
bins = {};
bin_rgx = "\[(?:BIN = \")(.*)(?:\" \d*)]\";

For Each Row(dt,
	If(Starts With(:Bins, "BIN = "),
		bin_str = Regex(:Bins, bin_rgx, "\1");
		Insert Into(bins, bin_str);
	);
);

show(bins); // bins = {".", "1", "2", "B", "P", "N", "A", "3", "F"};
-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: extract a particular sting

If this is related to text parsing from Import x and y values from the text file to jmp table and create wafer map I would use different approach. But let's assume that we start with the existing data table.

 

I would most likely use Regex if the pattern stays always the same:

Names Default To Here(1);

dt = Open("$DOWNLOADS/Bin table.jmp");
bins = {};
bin_rgx = "\[(?:BIN = \")(.*)(?:\" \d*)]\";

For Each Row(dt,
	If(Starts With(:Bins, "BIN = "),
		bin_str = Regex(:Bins, bin_rgx, "\1");
		Insert Into(bins, bin_str);
	);
);

show(bins); // bins = {".", "1", "2", "B", "P", "N", "A", "3", "F"};
-Jarmo
Jackie_
Level VI

Re: extract a particular sting

Thanks Jarmo. It works

Jackie_
Level VI

Re: extract a particular sting

@jthi 

 

I tried on a different wafer and it doesn't work for some bins 

 

BINS = 4
BIN = "A" 2 "Alignment_Die"
BIN = "C" 28615 "D1QM1804101"
BIN = "D" 23501 "D1QM1804102"
BIN = "F" 0 "Fail" ""
BIN = "N" 0 "Not Tested"
BIN = "P" 2806 "PCM die" ""

 bins = {"A", "C", "D", "F\!" 0 \!"Fail", "N", "P\!" 2806 \!"PCM die"};

dt = current data table();
bins = {};


bin_rgx = "\[(?:BIN = \")(.*)(?:\" \d*)]\";

For Each Row(dt,
	If(Starts With(:Bins, "BIN = "),
		bin_str = Regex(:Bins, bin_rgx, "\1");
		Insert Into(bins, bin_str);
	);
);

show(bins); // bins = {"A", "C", "D", "F\!" 0 \!"Fail", "N", "P\!" 2806 \!"PCM die"};

 

 

jthi
Super User

Re: extract a particular sting

I would suggest testing out the regex either on JMP or on https://regex101.com/r/DPngn1/1 . Choose one failing string and then test it out to see how and why it fails. In this case my regex pattern does require slight modification as it sometimes matches too much.

-Jarmo