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
andrey
Level I

concatenate tables only if they exists

I am trying to create a workflow when I would like to open multiple tables and concatenate them. The issue I am running into is that I don't know whether the tables will be available. As an example let's assume I may have up to 8 tables total. Let's call them table1, table2... table8.

The workflow I created assumed all tables exists, but if I remove one or a few tables it generates the error since the table/s cannot be found. 

For open table step I have found a solution by adding action before step that will check if the table exists  

Try(

Data Table("table1");

tableExist = 1

,

tableExist = 0

);

 

Though I am not sure how to implement similar solution when I am trying to concatenate all available tables.

4 REPLIES 4
txnelson
Super User

Re: concatenate tables only if they exists

I would use something like

If(
	Try( Data Table( "big class" ) << get name, "" ) != "" & Try(
		Data Table( "air traffic" ) << get name,
		""
	) != "",
	Data Table( "big class" ) << concatenate( Data Table( "air traffic" ) )
)
Jim
andrey
Level I

Re: concatenate tables only if they exists

@txnelson Thank you the reply. Wouldn't this code only run if "big class" table was already open? Also I would have to repeat the process for the remaining tables I am assuming by adding one new table one at the time.

PS: I have tried this code and if "big class" table is not opened it asks me to choose another table.

txnelson
Super User

Re: concatenate tables only if they exists

if either the big class data table, or the air traffic data table is not open, nothing will happen, no concatenation will take place.  If both tables are open, the tables will be concatenated.

 

I have tested the code in JMP 18 and JMP 14 and it works as I specified.  I suspect you have placed your Concatenation outside of the IF() function specification.

Jim

Re: concatenate tables only if they exists

Hey Andrey,

If you’re being prompted to open a table when running that script, I suspect you are running it inside a JMP workflow. You can turn off that prompt from the workflow red triangle, uncheck “Allow replacement of references.”

https://www.jmp.com/support/help/en/18.1/index.shtml#page/jmp/workflow-builder-red-triangle-menu-opt...