cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
TDK_Long
Level III

Data table order is commingled

Hi folks,

 

I have three FRF (txt style) files to be imported into JMP, and I had the following script to import and process the data. I have one description table that has three description items, which need to be assigned to the FRF data table in an ascending order. For example:

 

z-ht_0.414 needs to be assigned to ccf_23101106.FRF

z-ht_0.464 needs to be assigned to ccf_23101703.FRF

z-ht_0.514 needs to be assigned to ccf_23101701.FRF

 

The problem of my script ends up opening ccf_23101703 later than ccf_23101701. As a result, the z-ht_0.514 is assigned to the second data table ccf_23101703 instead of the third data table ccf_23101701. It shows that ccf_101703 is the data table window opened last, but in my script, ccf_101703 should be the second data table window opened. Can anyone help explain this weird thing and provide a solution to my question? I have copied my script below and attached the raw data. Please let me know if you need further information. Thanks.

//-----------------------------------------------------------------------------------------------------------------

Names Default To Here( 1 );
Clear Globals();
 
Description = New Table( "Description",
	Add Rows( 0 ),
	New Column( "Descriptioin",
		Character,
		set values(
			{
 
//==========================================================================
			// Manual input #1: the description of the FRF data (need to keep the colon)
			//==========================================================================
			"z-ht_0.414", "z-ht_0.464", "z-ht_0.514"}
		)
	)
);
FRF_file_num = N Rows( Description );
 
dtList = Multiple File Import(
	<<Set Folder( "E:\Reports\_ Software\JMP Learning\6 - FRF plotter for FEA\" ),
	<<Set Show Hidden( 0 ),
	<<Set Subfolders( 0 ),
	<<Set Name Filter
	//==========================================================================
	// Manual input #2: the name of the FRF data (need to keep the colon)
	//==========================================================================
	("
ccf_23101106.frf;
ccf_23101703.frf;
ccf_23101701.frf; 
"), 
 
	<<Set Name Enable( 1 ),
	<<Set Size Filter( {90190, 90190} ),
	<<Set Size Enable( 0 ),
	<<Set Date Filter( {3761729046.157, 3761730593.651} ),
	<<Set Date Enable( 0 ),
	<<Set Add File Name Column( 1 ),
	<<Set Add File Size Column( 0 ),
	<<Set Add File Date Column( 0 ),
	<<Set Import Mode( "CSVData" ),
	<<Set Charset( "Best Guess" ),
	<<Set Stack Mode( "Stack Similar" ),
	<<Set CSV Has Headers( 1 ),
	<<Set CSV Allow Numeric( 1 ),
	<<Set CSV First Header Line( 1 ),
	<<Set CSV Number Of Header Lines( 1 ),
	<<Set CSV First Data Line( 7 ),        // First row starts from row #7
	<<Set CSV EOF Comma( 0 ),
	<<Set CSV EOF Tab( 0 ),
	<<Set CSV EOF Space( 0 ),
	<<Set CSV EOF Spaces( 1 ),
	<<Set CSV EOF Other( "" ),
	<<Set CSV EOL CRLF( 1 ),
	<<Set CSV EOL CR( 1 ),
	<<Set CSV EOL LF( 1 ),
	<<Set CSV EOL Semicolon( 0 ),
	<<Set CSV EOL Other( "" ),
	<<Set CSV Quote( "\!"" ),
	<<Set CSV Escape( "" ),
	<<Set XML Method( "guess" ),
	<<Set XML Guess( "huge" ),
	<<Set XML Settings( XML Settings() ),
	<<Set JSON Method( "guess" ),
	<<Set JSON Guess( "huge" ),
	<<Set JSON Settings( JSON Settings() ),
	<<Set Import Callback( Empty() )
) << Import Data;
 
//==========================================================================
// Process the raw FRF data table for each indivdual FRF data
//==========================================================================
 
For( i = 1, i <= FRF_file_num, i++,
	dtList[i] << Set Window Size( 880, 400 );
	dtList[i] << Move Window( 1600, 0 + i * 20 );
	Column( dtList[i], 1 ) << setname( "Null" );
	Column( dtList[i], 2 ) << setname( "Freq kHz" );
	Column( dtList[i], 3 ) << setname( "Disp 1" );
	Column( dtList[i], 4 ) << setname( "FRF Phase" );
	Column( dtList[i], 5 ) << setname( "Disp 2" );
	Column( dtList[i], 6 ) << setname( "Phase 2" );
	Column( dtList[i], 7 ) << setname( "FRF Gain" );
	Column( dtList[i], 8 ) << setname( "Description" ); 
 
	Nrow = N Rows( dtList[i] );
	For( j = 1, j <= Nrow, j++,
		dtList[i][j, 2] = dtList[i][j, 2] / 1000;
		dtList[i][j, 7] = 20 * Log10( dtList[i][j, 3] / dtList[i][1, 3] );
		dtList[i][j, 8] = Description[i, 1];
	);
 
	dtList[i]:Null << Set Selected;
	dtList[i]:Disp 1 << Set Selected;
	dtList[i]:Disp 2 << Set Selected;
	dtList[i]:Phase 2 << Set Selected;
	dtList[i] << Delete Columns();  
//Wait (2);
 
);
 
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Data table order is commingled

If I am understanding the issue correctly, I forced the processing by inputting only one file at a time.  See my JSL below

//-----------------------------------------------------------------------------------------------------------------

Names Default To Here( 1 );
Clear Globals();
 
Description = New Table( "Description",
	Add Rows( 0 ),
	New Column( "Descriptioin",
		Character,
		set values(
			{
 
			//==========================================================================
			// Manual input #1: the description of the FRF data (need to keep the colon)
			//==========================================================================
			"z-ht_0.414", "z-ht_0.464", "z-ht_0.514"}
		)
	)
);
dtList = {};
FRF_file_num = N Rows( Description );
fileList = {"ccf_23101106.frf.txt", "ccf_23101703.frf.txt", "ccf_23101701.frf.txt"};
For Each( {file}, fileList,
	dt = Multiple File Import(
		<<Set Folder( "C:\Users\Jim\Documents\Discussion Group" ),
		<<Set Show Hidden( 0 ),
		<<Set Subfolders( 0 ),
		<<Set Name Filter//==========================================================================
		// Manual input #2: the name of the FRF data (need to keep the colon)
		//==========================================================================
		(file), 
 
		<<Set Name Enable( 1 ),
		<<Set Size Filter( {90190, 90190} ),
		<<Set Size Enable( 0 ),
		<<Set Date Filter( {3761729046.157, 3761730593.651} ),
		<<Set Date Enable( 0 ),
		<<Set Add File Name Column( 1 ),
		<<Set Add File Size Column( 0 ),
		<<Set Add File Date Column( 0 ),
		<<Set Import Mode( "CSVData" ),
		<<Set Charset( "Best Guess" ),
		<<Set Stack Mode( "Stack Similar" ),
		<<Set CSV Has Headers( 1 ),
		<<Set CSV Allow Numeric( 1 ),
		<<Set CSV First Header Line( 1 ),
		<<Set CSV Number Of Header Lines( 1 ),
		<<Set CSV First Data Line( 7 ),        // First row starts from row #7
		<<Set CSV EOF Comma( 0 ),
		<<Set CSV EOF Tab( 0 ),
		<<Set CSV EOF Space( 0 ),
		<<Set CSV EOF Spaces( 1 ),
		<<Set CSV EOF Other( "" ),
		<<Set CSV EOL CRLF( 1 ),
		<<Set CSV EOL CR( 1 ),
		<<Set CSV EOL LF( 1 ),
		<<Set CSV EOL Semicolon( 0 ),
		<<Set CSV EOL Other( "" ),
		<<Set CSV Quote( "\!"" ),
		<<Set CSV Escape( "" ),
		<<Set XML Method( "guess" ),
		<<Set XML Guess( "huge" ),
		<<Set XML Settings( XML Settings() ),
		<<Set JSON Method( "guess" ),
		<<Set JSON Guess( "huge" ),
		<<Set JSON Settings( JSON Settings() ),
		<<Set Import Callback( Empty() )
	) << Import Data;
	Insert Into( dtList, dt );
);
//==========================================================================
// Process the raw FRF data table for each indivdual FRF data
//==========================================================================
 
For( i = 1, i <= FRF_file_num, i++,
	dtList[i] << Set Window Size( 880, 400 );
	dtList[i] << Move Window( 1600, 0 + i * 20 );
	Column( dtList[i], 1 ) << setname( "Null" );
	Column( dtList[i], 2 ) << setname( "Freq kHz" );
	Column( dtList[i], 3 ) << setname( "Disp 1" );
	Column( dtList[i], 4 ) << setname( "FRF Phase" );
	Column( dtList[i], 5 ) << setname( "Disp 2" );
	Column( dtList[i], 6 ) << setname( "Phase 2" );
	Column( dtList[i], 7 ) << setname( "FRF Gain" );
	Column( dtList[i], 8 ) << setname( "Description" ); 
 
	Nrow = N Rows( dtList[i] );
	For( j = 1, j <= Nrow, j++,
		dtList[i][j, 2] = dtList[i][j, 2] / 1000;
		dtList[i][j, 7] = 20 * Log10( dtList[i][j, 3] / dtList[i][1, 3] );
		dtList[i][j, 8] = Description[i, 1];
	);
 
	dtList[i]:Null << Set Selected;
	dtList[i]:Disp 1 << Set Selected;
	dtList[i]:Disp 2 << Set Selected;
	dtList[i]:Phase 2 << Set Selected;
	dtList[i] << Delete Columns();  
//Wait (2);
 
);
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Data table order is commingled

try adding

current data table() << rerun formulas;

after the input JSL for the txt file.

Jim
TDK_Long
Level III

Re: Data table order is commingled

Hi Jim,

 

Thank you for looking into my case. Your above suggestion seems not solving my problem. My problem is when I import multiple files into JMP, the importing action does not follow the order of the files that I list. For example, when I try to import the following files:

ccf_008, ccf_005, ccf_007, ccf_002 in this order, but JMP will automatically sort the names of the files and generate the data table windows in the this order: ccf_002, ccf_005, ccf_007, ccf_008, which is not the order I want. Is there anyway that I can keep the order of the files because I need to assign the description to the files respectively? If the order is messed up, all of the data will be mistakenly labeled. Thank you. 

 

 

txnelson
Super User

Re: Data table order is commingled

If I am understanding the issue correctly, I forced the processing by inputting only one file at a time.  See my JSL below

//-----------------------------------------------------------------------------------------------------------------

Names Default To Here( 1 );
Clear Globals();
 
Description = New Table( "Description",
	Add Rows( 0 ),
	New Column( "Descriptioin",
		Character,
		set values(
			{
 
			//==========================================================================
			// Manual input #1: the description of the FRF data (need to keep the colon)
			//==========================================================================
			"z-ht_0.414", "z-ht_0.464", "z-ht_0.514"}
		)
	)
);
dtList = {};
FRF_file_num = N Rows( Description );
fileList = {"ccf_23101106.frf.txt", "ccf_23101703.frf.txt", "ccf_23101701.frf.txt"};
For Each( {file}, fileList,
	dt = Multiple File Import(
		<<Set Folder( "C:\Users\Jim\Documents\Discussion Group" ),
		<<Set Show Hidden( 0 ),
		<<Set Subfolders( 0 ),
		<<Set Name Filter//==========================================================================
		// Manual input #2: the name of the FRF data (need to keep the colon)
		//==========================================================================
		(file), 
 
		<<Set Name Enable( 1 ),
		<<Set Size Filter( {90190, 90190} ),
		<<Set Size Enable( 0 ),
		<<Set Date Filter( {3761729046.157, 3761730593.651} ),
		<<Set Date Enable( 0 ),
		<<Set Add File Name Column( 1 ),
		<<Set Add File Size Column( 0 ),
		<<Set Add File Date Column( 0 ),
		<<Set Import Mode( "CSVData" ),
		<<Set Charset( "Best Guess" ),
		<<Set Stack Mode( "Stack Similar" ),
		<<Set CSV Has Headers( 1 ),
		<<Set CSV Allow Numeric( 1 ),
		<<Set CSV First Header Line( 1 ),
		<<Set CSV Number Of Header Lines( 1 ),
		<<Set CSV First Data Line( 7 ),        // First row starts from row #7
		<<Set CSV EOF Comma( 0 ),
		<<Set CSV EOF Tab( 0 ),
		<<Set CSV EOF Space( 0 ),
		<<Set CSV EOF Spaces( 1 ),
		<<Set CSV EOF Other( "" ),
		<<Set CSV EOL CRLF( 1 ),
		<<Set CSV EOL CR( 1 ),
		<<Set CSV EOL LF( 1 ),
		<<Set CSV EOL Semicolon( 0 ),
		<<Set CSV EOL Other( "" ),
		<<Set CSV Quote( "\!"" ),
		<<Set CSV Escape( "" ),
		<<Set XML Method( "guess" ),
		<<Set XML Guess( "huge" ),
		<<Set XML Settings( XML Settings() ),
		<<Set JSON Method( "guess" ),
		<<Set JSON Guess( "huge" ),
		<<Set JSON Settings( JSON Settings() ),
		<<Set Import Callback( Empty() )
	) << Import Data;
	Insert Into( dtList, dt );
);
//==========================================================================
// Process the raw FRF data table for each indivdual FRF data
//==========================================================================
 
For( i = 1, i <= FRF_file_num, i++,
	dtList[i] << Set Window Size( 880, 400 );
	dtList[i] << Move Window( 1600, 0 + i * 20 );
	Column( dtList[i], 1 ) << setname( "Null" );
	Column( dtList[i], 2 ) << setname( "Freq kHz" );
	Column( dtList[i], 3 ) << setname( "Disp 1" );
	Column( dtList[i], 4 ) << setname( "FRF Phase" );
	Column( dtList[i], 5 ) << setname( "Disp 2" );
	Column( dtList[i], 6 ) << setname( "Phase 2" );
	Column( dtList[i], 7 ) << setname( "FRF Gain" );
	Column( dtList[i], 8 ) << setname( "Description" ); 
 
	Nrow = N Rows( dtList[i] );
	For( j = 1, j <= Nrow, j++,
		dtList[i][j, 2] = dtList[i][j, 2] / 1000;
		dtList[i][j, 7] = 20 * Log10( dtList[i][j, 3] / dtList[i][1, 3] );
		dtList[i][j, 8] = Description[i, 1];
	);
 
	dtList[i]:Null << Set Selected;
	dtList[i]:Disp 1 << Set Selected;
	dtList[i]:Disp 2 << Set Selected;
	dtList[i]:Phase 2 << Set Selected;
	dtList[i] << Delete Columns();  
//Wait (2);
 
);
Jim
TDK_Long
Level III

Re: Data table order is commingled

Hi Jim,

 

Perfect. It is what I am looking for. Learned a lot from your script. Thanks for the quick turnaround.