Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Re: Populating the data in new table with variable defined in script

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jun 3, 2019 2:32 AM
(631 views)

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

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.

3 REPLIES 3

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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"

i tried using your second example, i am getting empty data table named " Result"

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.