cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
LukeFarrell
Level III

JMP14 Script Compatibility with Older Versions

Hi There, 

 

I am looking to see if anyone could give some advice on writing scritps and making them compatible on older versions of JMP. Recently I have been working on a script which converts a cvs file to a data sheet on JMP and setting the different columns to have different properies (such as modelling types, formulae, etc.) It has been working fine on PCs using JMP14, however when a colleague of mine tries to use the script, it does not work. I descovered that he is using JMP13 and when the script runs it does not change the modelling type to "Nominal" but rather "Continuous".

 

Please see the script extract which I am using for the modelling conversion. 

....
New Column( "DateTime",
			Numeric,
			"Nominal",
			Format( "y/m/d h:m"),
			Input Format( "y/m/d h:m:s", 3 )
		),
....

 

I was hoping someone could provide some advice if there is a way to make the script compatable. Any help would be much appreciated.

 

Thank you,

Luke 

~ Luke :)
1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: JMP14 Script Compatibility with Older Versions

Another thought, at this point this is just an intellectual excercise to figure out why the two are behaving differently. If you want to ensure that the DateTime column is nominal you can do it after the Open() and that should work.

 

newdt = Open(
	"$SAMPLE_DATA/../Import Data/BigClass.txt",
	columns(
		New Column( "Name", Character, "Nominal" ),
		New Column( "Date",
			Numeric,
			"Continuous",
			Format( "m/d/y", 10 ),
		),
		New Column( "Sex", Character, "Nominal" ),
		New Column( "height", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "weight", Numeric, "Continuous", Format( "Best", 12 ) )
	),
	Import Settings(
		End Of Line( CRLF, CR, LF ),
		End Of Field( Tab, CSV( 0 ) ),
		Strip Quotes( 1 ),
		Use Apostrophe as Quotation Mark( 0 ),
		Use Regional Settings( 0 ),
		Scan Whole File( 1 ),
		Treat empty columns as numeric( 0 ),
		CompressNumericColumns( 0 ),
		CompressCharacterColumns( 0 ),
		CompressAllowListCheck( 0 ),
		Labels( 0 ),
		Column Names Start( 1 ),
		Data Starts( 1 ),
		Lines To Read( "All" ),
		Year Rule( "20xx" )
	)
);

//set modeling type after import newdt:Date << set modeling type( "Nominal" );
-Jeff

View solution in original post

13 REPLIES 13

Re: JMP14 Script Compatibility with Older Versions

Unfortunately, we must change how some parameters are passed as arguments. In your case, the new and preferred way to specify the modeling type of a data column is "Continuous" (a character string). Previously, it was a Continuous (a named argument).

 

The good news is that you can ask JMP its version information and use an If() function to determine the best way to proceed.

LukeFarrell
Level III

Re: JMP14 Script Compatibility with Older Versions

Hi Mark, 

 

As I am relitively new to JMP I am unsure of how to do this. 

 

Is this the method one could use?

 

jmpver = num(left(jmpversion(),2));
path = Get Default Directory(); 
dt = Pick File("Select .csv file with  data", path, {"Excel|csv;xlsx;xls", "JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, ""); 
Open(dt,
columns(
		New Column( "DateTime",
			Numeric,
			if(jmpver >= 14,
				"Nominal",
				/*else if*/ jmpver == 13,
				Nominal),
			Format( "y/m/d h:m"),
			Input Format( "y/m/d h:m:s", 3 )
		),

.....

Thank you for your help, 

Luke

~ Luke :)

Re: JMP14 Script Compatibility with Older Versions

I was thinking something simple like this:

 

jmpver = Num( Left( JMP Version(), 2 ) );

path = Get Default Directory();

f = Pick File( "Select .csv file with  data", path, {"Excel|csv;xlsx;xls", "JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "" ); 

dt = Open( path || f );

If(
	jmp ver > 13, 
	// use string argument
	dt << New Column( "DateTime", Numeric, "Nominal", Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s", 3 ) ), 
	// use named argument
	dt << New Column( "DateTime", Numeric, Nominal, Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s", 3 ) ),
);
LukeFarrell
Level III

Re: JMP14 Script Compatibility with Older Versions

Hi Mark, 

Thank you again for the help. Then as I have many more columns should I place these into both the string argument and the named such as below?

 

If(
	jmp ver > 13, 
	// use string argument
	dt << New Column( "DateTime", Numeric, "Nominal", Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s", 3 ) ),
dt << New Column( "NSR_ID", Character, "Nominal" ), \\and follows for the rest // use named argument dt << New Column( "DateTime", Numeric, Nominal, Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s", 3 ) ), dt << New Column( "NSR_ID", Character, "Nominal" ), \\and follows for the rest );

Or could I do a similar method as I previously did?

 

Thanks again, 

Luke

~ Luke :)

Re: JMP14 Script Compatibility with Older Versions

You have the correct idea, but the syntax is wrong. Without getting into the details, you separate function arguments with commas. You glue function calls together with semi-colons. So the If() function call should separate arguments (Boolean, expression, Boolean, expression, ...) with commas. The expressions might involve more than one function, so within one argument we glue the functions together with a semi-colon. It might look like this:

 

jmpver = Num( Left( JMP Version(), 2 ) );

path = Get Default Directory();

f = Pick File( "Select .csv file with  data", path, {"Excel|csv;xlsx;xls", "JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "" ); 

dt = Open( path || f );

If(
	jmp ver > 13, 
	// use string argument
	dt << New Column( "Date Time", Numeric, "Nominal", Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s", 3 ) );
	dt << New Column( "Blah", Numeric, "Nominal", Values( ... ) );
	dt << New Column( "Blah Blah", Numeric, "Nominal", Values( ... ) );
	, 
	// use named argument
	dt << New Column( "Date Time", Numeric, Nominal, Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s", 3 ) );
	dt << New Column( "Blah", Numeric, Nominal, Values( ... ) );
	dt << New Column( "Blah Blah", Numeric, Nominal, Values( ... ) );
);

(Note I left the first comma in the If() function to emphasize its purpose.)

 

The first expression glues three Send() functions together. Each message send adds a new column.

 

I hope that this information is enlightening rather than confusing! JSL is a little different.

 

LukeFarrell
Level III

Re: JMP14 Script Compatibility with Older Versions

Thank you again for all the help, however I am still getting the same issue. So currently if I use JMP14 or 13 the DateTime column is still Continuous. 

 

I am unsure of why this is as I copied the method you used as seen below:

 

jmpver = Num( Left( JMP Version(), 2 ) );
path = Get Default Directory(); 
f = Pick File( "Select .csv file with  data", path, {"Excel|csv;xlsx;xls", "JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "" ); 

dt = Open( f );

If(
	jmp ver > 13, 
	// use string argument
	dt << 	New Column( "DateTime", Numeric, "Nominal", Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s") );
	dt << 	New Column( "NSR_ID", Character, "Nominal" );
	dt <<	New Column( "TaskId", Character, "Nominal" );
\\\etc.

,	
	
	// use named argument
	dt <<	New Column( "DateTime", Numeric, Nominal, Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s" ) );
	dt << 	New Column( "NSR_ID", Character, "Nominal" );
	dt <<	New Column( "TaskId", Character, "Nominal" );
\\\etc.
);

 

~ Luke :)

Re: JMP14 Script Compatibility with Older Versions

My bad. I did not fully edit the previous version. Does this one work:

 

jmpver = Num( Left( JMP Version(), 2 ) );
path = Get Default Directory(); 
f = Pick File( "Select .csv file with  data", path, {"Excel|csv;xlsx;xls", "JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "" ); 

dt = Open( f );

If(
	jmp ver > 13, 
	// use string argument
	dt
		<< New Column( "DateTime", Numeric, "Continuous", Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s") )
		<< New Column( "NSR_ID", Character, "Nominal" )
		<< New Column( "TaskId", Character, "Nominal" );
		// etc.
,	
	// use named argument
	dt
		<< New Column( "DateTime", Numeric, Continuous, Format( "y/m/d h:m" ), Input Format( "y/m/d h:m:s") )
		<< New Column( "NSR_ID", Character, Nominal )
		<< New Column( "TaskId", Character, Nominal );
		// etc.
);
Jeff_Perkinson
Community Manager Community Manager

Re: JMP14 Script Compatibility with Older Versions

All due respect to @Mark_Bailey, but I don't think the issue is with the style of the argument specifying the modelling type.

 

I tried the original code:

 

dt = New Table();

dt << New Column( "DateTime",
	Numeric,
	"Nominal",
	Format( "y/m/d h:m" ),
	Input Format( "y/m/d h:m:s", 3 )
);

 in JMP 12, JMP 13, and JMP 14 and got a Nominal column in each case.

 

I think there must be something else going on.

 

@LukeFarrell, can you please try the simplified code above to see if it creates a Nominal column on your machine in JMP 14 and on your colleagues machine in JMP 13?

 

If it does then there's something else in your (presumably) larger script that is interfering. If that's the case we'll need some more details about the larger script to help you.

-Jeff
LukeFarrell
Level III

Re: JMP14 Script Compatibility with Older Versions

Hi @Jeff_Perkinson using my original code, which seems similar to yours.

 

path = Get Default Directory(); 
dt = Pick File("Select .csv file with  data", path, {"Excel|csv;xlsx;xls", "JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, ""); 
Open(dt,
columns(
		New Column( "DateTime",
			Numeric,
			"Nominal",
			Format( "y/m/d h:m"),
			Input Format( "y/m/d h:m:s", 3 )
		),
		New Column( "NSR_ID", Character, "Nominal" ),
		New Column( "TaskId", Character, "Nominal" ),
		New Column( "TaskType", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "TaskCreateTime",
			Numeric,
			"Continuous",
			Format( "y/m/d h:m:s", 26, 3 ),
			Input Format( "y/m/d h:m:s", 3 )
		),
		New Column( "RecipeFile", Character, "Nominal" ),
		New Column( "PureRecipeFile", Character, "Nominal" ),
		New Column( "Product", Character, "Nominal" ),
		New Column( "Layer", Character, "Nominal" ),
		New Column( "LotLabel", Character, "Nominal" ),
		New Column( "PureLotLabel", Character, "Nominal" ),
		New Column( "Reticle1", Character, "Nominal" ),
		New Column( "IllumId", Character, "Nominal" ),
		New Column( "ResultFile", Character, "Nominal" ),
		New Column( "ExpLogName", Character, "Nominal" ),
		New Column( "AtmPres", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "AtmPresTime",
			Numeric,
			"Continuous",
			Format( "y/m/d h:m:s", 26, 3 ),
			Input Format( "y/m/d h:m:s", 3 )
		),
		New Column( "WCt", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "RepCt", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "AFZType", Character( 1 ), "Nominal" ),
		New Column( "MeasPos/X", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "MeasPos/Y", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "MeasPos/Rot", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "MeasPos/Z", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "MeasPos/TiltX", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "MeasPos/TiltY", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "MeasMode", Character( 1 ), "Nominal" ),
		New Column( "ScanVelocity", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "ScanLength", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "ScanDirection", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "ScanNum", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "MeasAveTime", Character( 1 ), "Nominal" ),
		New Column( "AsocPk", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "RefMeasDate", Character, "Nominal" ),
		New Column( "WTD_Z", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "IF_Roll(ZF1)", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "IF_Pitch(ZF12)", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "IF_AF-Z(Ave_ZF12)",
			Numeric,
			"Continuous",
			Format( "Best", 12 )
		),
		New Column( "IF_AIS-Z(ZB3)", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "IF_AIS-Z(ZB3_Abbe)",
			Numeric,
			"Continuous",
			Format( "Best", 12 )
		),
		New Column( "IF_ZF1", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "IF_ZF2", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "IF_ZF12", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "IF_ZB3", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Roll_ZF1", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Roll_ZF2", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Roll_ZF12", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Roll_ZB3", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Pitch_ZF12", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Pitch_ZF1ZB3", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Pitch_ZF2ZB3", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "RetryCount", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "WaterRefInterp", Character, "Nominal" ),
		New Column( "OK/NG", Character, "Nominal" ),
		New Column( "G-ASOC_AFZ", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "WFMsens_Ave", Character( 1 ), "Nominal" ),
		New Column( "Ave", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "TiltX", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "TiltY", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "CurveX", Character( 1 ), "Nominal" ),
		New Column( "1", Character( 1 ), "Nominal" ),
		New Column( "2", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "3", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "4", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "5", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "6", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "7", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "8", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "9", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "10", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "11", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "12", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "13", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "14", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "15", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "16", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "17", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "18", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "19", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "20", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "21", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "22", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "23", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "24", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "25", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "26", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "27", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "28", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "29", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "30", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "31", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "32", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "33", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "34", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "35", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "36", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "37", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "38", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "39", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "40", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "41", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "42", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "43", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "44", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "45", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "46", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "47", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "48", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "49", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "50", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "51", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "52", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "53", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "54", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "55", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "56", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "57", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "58", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "59", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "60", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "61", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "62", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "63", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "64", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "65", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "66", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "67", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "68", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "69", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "70", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "71", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "72", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "73", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "74", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "75", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "76", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "77", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "78", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "79", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "80", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "81", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "82", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "83", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "AtmPres 2", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "AtmPresTime 2",
			Numeric,
			"Continuous",
			Format( "y/m/d h:m:s", 26, 3 ),
			Input Format( "y/m/d h:m:s", 3 )
		),
		New Column( "AtmPresTimeDelta",
			Numeric,
			"Continuous",
			Format( "Best", 12 )
		),
		New Column( "AtmPresEventID", Character, "Nominal" )
	),
	Import Settings(
		End Of Line( CRLF, CR, LF ),
		End Of Field( Comma, CSV( 1 ) ),
		Strip Quotes( 0 ),
		Use Apostrophe as Quotation Mark( 0 ),
		Use Regional Settings( 0 ),
		Scan Whole File( 1 ),
		Treat empty columns as numeric( 0 ),
		CompressNumericColumns( 0 ),
		CompressCharacterColumns( 0 ),
		CompressAllowListCheck( 0 ),
		Labels( 1 ),
		Column Names Start( 1 ),
		Data Starts( 2 ),
		Lines To Read( "All" ),
		Year Rule( "20xx" )
	)
);

This one works to make the DateTime "Nominal" modelling type in JMP14 but not 13.

 

When using your simplified script it works it creats the correct type of model.

 

Thank you for your help

~ Luke :)