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
johnm
Level III

Parse a Data Table Name or File Name; Extract; Split; Word

Hello, 

Haven't yet figured out how to parse fields in a file name or use word() function with the text argument a variable rather than a true text string.  

 

Example:

dtd00 = Open(
	"$0802\field1_field2_field3.txt",
	Import Settings( End Of Field( Spaces, Space, CSV( 0 ) ) )
); // 

my_fld1 = Word( 1, "field1_field2_field3.txt", "_" );  // 

// This does set my_fld1 = field1

my_fld2 = Word( 2, (dtd00), "_" );  // 

// This doesn't set my_fld2 = field2

 

Reaching out for suggestions,

 

JohnM

1 ACCEPTED SOLUTION

Accepted Solutions
johnm
Level III

Re: Parse a Data Table Name or File Name; Extract; Split; Word

With some more JSL manual surfing, found an approach.

my_file_name = dtd00 << get name;
// then add a column for example;
dtd00 << New Column( "my_fld2", formula( Word( 2, my_file_name, "_" ) ) );

 

 

 

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Parse a Data Table Name or File Name; Extract; Split; Word

dtd00 has reference to the datatable you did open. You have to get the name of datatable, which you can do with

dtd00 << Get Name;
-Jarmo
johnm
Level III

Re: Parse a Data Table Name or File Name; Extract; Split; Word

With some more JSL manual surfing, found an approach.

my_file_name = dtd00 << get name;
// then add a column for example;
dtd00 << New Column( "my_fld2", formula( Word( 2, my_file_name, "_" ) ) );