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

Stack output table name

Hi,

I have a script that dynamically parses some of the info for stack table and would like to store the stack table as a new data table.

 

ystr1 = ":INFRASTRUCTURE Value, :INFRASTRUCTURE Value 1"

infr = "Infrastructure Value";
data = "PPT";
output_name = "infra_updated.jmp";
gbStr = EvalInsert("dt << Stack(
columns(
^ystr1^
),
Source Label Column(^infr^ ),
Stacked Data Column(^data^),
Output Table(^output_name^ )
)"
);
 
Eval(Parse(gbStr));

 

 

I am getting the following error 

Name Unresolved: infra_updated..jmp in access or evaluation of 'infra_updated.jmp'

 

Unable to figure out why EvalInsert doesn't work for Output Table

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Stack output table name

Quotes need to be around the Output Table() specified name.  Therefore, they need to be added to the string value for your output_name variable

ystr1 = ":INFRASTRUCTURE Value, :INFRASTRUCTURE Value 1";

infr = "Infrastructure Value";
data = "PPT";
output_name = "\!"infra_updated\!"";
gbStr = Eval Insert(
	"dt << Stack(
columns(
^ystr1^
),
Source Label Column(^infr^ ),
Stacked Data Column(^data^),
Output Table(^output_name^ )
)"
);
 
Eval( Parse( gbStr ) );
Jim

View solution in original post

jthi
Super User

Re: Stack output table name

Jim already gave the reason what is going wrong in your script. I would suggest you use other methods than Eval(Parse()) as it can be extremely difficult to debug and you don't have syntax highlighting in script editor

Names Default To Here(1);

/*
dt = Open("$SAMPLE_DATA/Big Class.jmp");
cols = {"age", "height"};
*/

cols = {"INFRASTRUCTURE Value", "INFRASTRUCTURE Value 1"};
infr = "Infrastructure Value";
data = "PPT";
output_name = "infra_updated";


dt_stacked = dt << Stack(
	Columns(Eval(cols)),
	Source Label Column(infr),
	Stacked Data Column(data),
	Output Table(output_name)
);

 

-Jarmo

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: Stack output table name

Quotes need to be around the Output Table() specified name.  Therefore, they need to be added to the string value for your output_name variable

ystr1 = ":INFRASTRUCTURE Value, :INFRASTRUCTURE Value 1";

infr = "Infrastructure Value";
data = "PPT";
output_name = "\!"infra_updated\!"";
gbStr = Eval Insert(
	"dt << Stack(
columns(
^ystr1^
),
Source Label Column(^infr^ ),
Stacked Data Column(^data^),
Output Table(^output_name^ )
)"
);
 
Eval( Parse( gbStr ) );
Jim
skollcruz23
Level I

Re: Stack output table name

Thank you for explaining the issue.
jthi
Super User

Re: Stack output table name

Jim already gave the reason what is going wrong in your script. I would suggest you use other methods than Eval(Parse()) as it can be extremely difficult to debug and you don't have syntax highlighting in script editor

Names Default To Here(1);

/*
dt = Open("$SAMPLE_DATA/Big Class.jmp");
cols = {"age", "height"};
*/

cols = {"INFRASTRUCTURE Value", "INFRASTRUCTURE Value 1"};
infr = "Infrastructure Value";
data = "PPT";
output_name = "infra_updated";


dt_stacked = dt << Stack(
	Columns(Eval(cols)),
	Source Label Column(infr),
	Stacked Data Column(data),
	Output Table(output_name)
);

 

-Jarmo
skollcruz23
Level I

Re: Stack output table name

I am fairly new to JSL scripting and still in the process of getting familiar with it. But I agree your solution looks more easy to debug. Thanks
skollcruz23
Level I

Re: Stack output table name

I tried your solution but i am seeing this error.  I do have the correct column names in the list.

"Column not found in access or evaluation of 'Stack' , Bad Argument"

jthi
Super User

Re: Stack output table name

For me it works fine in JMP18 (and 17) when I test it with the example I left in the code

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

cols = {"age", "height"};
infr = "Infrastructure Value";
data = "PPT";
output_name = "infra_updated";

dt_stacked = dt << Stack(
	Columns(Eval(cols)),
	Source Label Column(infr),
	Stacked Data Column(data),
	Output Table(output_name)
);

jthi_0-1721224885130.png

Are you sure the column names are written correctly and they are in a list?

-Jarmo