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

display row entries in a List box

I have a script that automatically opens and concat's files that the user selects.  basically, each file corresponds to a separate manufacturing batch. the user runs the script, a dialogue box shows up and the user selects all the files he/she wants to concat.  originally, the list of available runs just came from a list of available files in the source folder. however, by default this orders the files based on alpha numeric name--which is not in anyway chronological.  what i've decided to do is to instead have the list populate from a separate table with the batch IDs entered in chronological order.  this didnt help as the string still comes out in alphanumeric order. I want the list box to preserve the order of the source table so i can quickly grab only the most recent runs, for example

 

if(
	File Exists("M:\Data\prod_data.csv"),
	Open("M:\Data\prod_data.csv"),
	New Window("File Path Not Valid",
		<< Modal,
		V List Box(
			Text Box ("File Not Found!")
			)	
		)
	);


Data Table( "prod_data" ) << Subset(
	All rows,
	columns( :Production ID ),
	Output Table ("Batch List"),
);


Close (Data Table ("prod_data"), No Save);
////////////////////

Clear Symbols( UniqueRuns );
Summarize(UniqueRuns = by(:Name("Production ID")));

For( i = 1, i <= N Items( UniqueRuns ), i++,
	UniqueRuns[i] = Regex( UniqueRuns[i], "offline_|.csv", "", GLOBALREPLACE )     

New Window( "Select Runs",  //creates a window from which users can select the runs they want to analyze by holding Ctrl or Shift
	<<Modal,
	V List Box(
		Panel Box( "Batch Numbers Present on List", Runs_entry = List Box( UniqueRuns ) ),
		BBox = Button Box( "OK",
			SelectedRuns = Runs_entry << Get Selected;
			BBox << Close Window;
		)
	)
);
1 REPLY 1
txnelson
Super User

Re: display row entries in a List box

If you set the Value Order column property to Row Order Levels the Summarize will return the list in the order found in the data table

:Production ID << set property("Value Order", {Common Order( 0 ), Row Order Levels( 1 )} );
Jim