cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
shah47
Level II

Help with Value Ordering

So I want to order my column a certain way by using the Value ordering property. In this case b1, b2 and b3 are user inputs from Text Edit Box but still the ordering in the column does not follow {"Buffer", b1, b2, b3} it follows an alphabetical order.

dt = current data table();

:Results<<set property("value ordering", {"Buffer", b1, b2, b3});

 I also tried the following after value ordering but it doesn't help

dt << Sort(By(:Results),Order(Ascending),Replace Table);

 

15 REPLIES 15
Thierry_S
Super User

Re: Help with Value Ordering

Never mind, I got it now
Best,
TS
Thierry R. Sornasse
shah47
Level II

Re: Help with Value Ordering

@Thierry_S @ron_horne 

Sorry for some of the confusion, this is the more extended version of my script

 

dt = current data table();
InputWindow = New Window( "Enter Input",
	<<modal(),
	Table Box(
		String Col Box( "Results",
			{"Results 01", "Results 02", "Results 03" }
		),
		Col Box(
			"Final Results",
			teb1 = Text Edit Box( "Blank Sample in wells" ),
			teb2 = Text Edit Box( "Blank Sample in wells" ),
			teb3 = Text Edit Box( "Blank Sample in wells" )			
		)
	),
	Button Box( "OK",
		b1 = teb1 << Get Text;
		b2 = teb2 << Get Text;
		b3 = teb3 << Get Text;		
	)
);
Show(s1,s2,s3,);
dt=current data table();
Try( :Results[dt << get rows where( :Raw values== "01a" )] = b1 );
Try( :Results[dt << get rows where( :Raw values== "01b" )] = b1 );
Try( :Results[dt << get rows where( :Raw values== "02a" )] = b2 );
Try( :Results[dt << get rows where( :Raw values== "02b" )] = b2 );
Try( :Results[dt << get rows where( :Raw values== "03a" )] = b3 );
Try( :Results[dt << get rows where( :Raw values== "03b" )] = b3 );

Wait(0);
dt = current data table();
:Results<<set property("value ordering", {"Buffer", b1, b2, b3});

dt = current data table();
dt << Sort(By(:Results),Order(Ascending),Replace Table);
Thierry_S
Super User

Re: Help with Value Ordering

Hi,

 

I'm still not clear what you are trying to do but the following slightly modified script does not return any error in the Log (see the Eval List call at the bottom)

Names Default to Here (1);

dt = current data table();
InputWindow = New Window( "Enter Input",
	<<modal(),
	Table Box(
		String Col Box( "Results",
			{"Results 01", "Results 02", "Results 03" }
		),
		Col Box(
			"Final Results",
			teb1 = Text Edit Box( "Blank Sample in wells" ),
			teb2 = Text Edit Box( "Blank Sample in wells" ),
			teb3 = Text Edit Box( "Blank Sample in wells" )			
		)
	),
	Button Box( "OK",
		b1 = teb1 << Get Text;
		b2 = teb2 << Get Text;
		b3 = teb3 << Get Text;		
	)
);
Show(b1,b2,b3,);
dt=current data table();
Try( :Results[dt << get rows where( :Raw values== "01a" )] = b1 );
Try( :Results[dt << get rows where( :Raw values== "01b" )] = b1 );
Try( :Results[dt << get rows where( :Raw values== "02a" )] = b2 );
Try( :Results[dt << get rows where( :Raw values== "02b" )] = b2 );
Try( :Results[dt << get rows where( :Raw values== "03a" )] = b3 );
Try( :Results[dt << get rows where( :Raw values== "03b" )] = b3 );

Wait(0);
dt = current data table();
:Results<<set property("value ordering", Eval List({"Buffer", b1, b2, b3}));

dt = current data table();
dt << Sort(By(:Results),Order(Ascending),Replace Table);
Thierry R. Sornasse
shah47
Level II

Re: Help with Value Ordering

@Thierry_S 

 

Lets say the user input the following for sample names in the text edit box:

C for b1

B for b2

A for b3

 

then the  column order becomes "Buffer", b3, b2, b1 when I run the script, it follows an alphabetical order. I want the script to run so that the column order remains  "Buffer", b1, b2, b3 no matter what is input as sample names.

 

Thierry_S
Super User

Re: Help with Value Ordering

Hi Shah,
I believe that the latest script I uploaded in my previous message performs the way you want. Have you tried it?
Best,
TS
Thierry R. Sornasse
shah47
Level II

Re: Help with Value Ordering

Hi @Thierry_S 

 

I tried your script but still the column order is alphabetical