BookmarkSubscribe
Choose Language Hide Translation Bar
dilipkumar
Community Trekker

Populating the data in new table with variable defined in script

Hi all,

Actually i am trying to perform a calculation in jmp script, i have defined these calculation using a variable. ( ie- a,b etc), now i trying to populate this variable into a new table, such that each time if input changes , calculation will change and new data will be populated in new table.

let us assume a= weibull function( consider every input i have for calculating a)

 

dt = New Table( "Result", 
	New Column( "X", 
		Expression, 
		"Nominal",
		Set Values( {a} )
	)
);

in new table i am getting output as a, not the value of a. i want value of a to be populated.

 

Thanks,

Dilip

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
Ryan_Gilmore
Community Manager Community Manager

Re: Populating the data in new table with variable defined in script

I think you may need to add some rows the table.

 

 

dt = New Table( "Result" );

// Method for inserting a function
b = Expr(
	Random Uniform( 1, 10 )
);
dt << New Column( "Y", continuous, "nominal", formula( Name Expr( b ) ) );

dt << add row( 5 );

In the first example, setting the values of column X automatically generated the rows.

 

 

0 Kudos
3 REPLIES 3
Ryan_Gilmore
Community Manager Community Manager

Re: Populating the data in new table with variable defined in script

Hi @dilipkumar ,

 

Not knowing what the variables (a, b, etc.) might contain, here are two examples if the variables contain a list or a function, that will populate the column with the values defined by the variable and not the variable itself,

 

dt = New Table( "Result" );

// Method for inserting a list or a matrix
a = [1, 2, 3, 4];
dt << New Column( "X", Continuous, "Nominal", Set Values( a ) );


// Method for inserting a function
b = Expr(
	Random Uniform( 1, 10 )
);
dt << New Column( "Y", continuous, "nominal", formula( Name Expr( b ) ) );

Hope that helps.

dilipkumar
Community Trekker

Re: Populating the data in new table with variable defined in script

My variable is function, it return some values,
i tried using your second example, i am getting empty data table named " Result"
0 Kudos
Ryan_Gilmore
Community Manager Community Manager

Re: Populating the data in new table with variable defined in script

I think you may need to add some rows the table.

 

 

dt = New Table( "Result" );

// Method for inserting a function
b = Expr(
	Random Uniform( 1, 10 )
);
dt << New Column( "Y", continuous, "nominal", formula( Name Expr( b ) ) );

dt << add row( 5 );

In the first example, setting the values of column X automatically generated the rows.

 

 

0 Kudos