cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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, "_" ) ) );

 

 

 

Recommended Articles