cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

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