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: how to add a new formula with JSL？

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

May 1, 2017 12:37 AM
(3356 views)

all i use the samlpe which named thickness.JMP to produce a new file by summary。 but i don not know to how to add one formula with JSL in summary table。

you are your god.

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted
Solution

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

Your formula involves division. It requires numeric data columns for this compuation. Your result is set up for a new column with the character data type. If that is what you want, then wrap the division inside the Char() function to satisfy the data type.

Learn it once, use it forever!

8 REPLIES 8

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

Re: how to add a new formula with JSL？

you are your god.

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

Re: how to add a new formula with JSL？

you are your god.

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

Re: how to add a new formula with JSL？

To create the summary table first and then add a formula column to it, save a reference to the table when you create it:

```
//Save reference to the newly created summary table.
dt = Data Table( "Thickness" ) << Summary( Group( :Bar ), N, Mean( :Thickness 01 ) );
//Send a message to the new table to create the new column.
dt << New Column( "New formula column",
Character,
Formula(
If( :Name( "Mean(Thickness 01)" ) > 0.04,
"normal",
"thin"
)
)
);
```

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

Re: how to add a new formula with JSL？

i want to calculate " Thickness 01/N rows ". JSL is below, that is right? dt << New Column( "New formula column", Character, Formula( :Name( "Thickness 01) / :Name( "N rows"));

you are your god.

Highlighted
Solution

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

Your formula involves division. It requires numeric data columns for this compuation. Your result is set up for a new column with the character data type. If that is what you want, then wrap the division inside the Char() function to satisfy the data type.

Learn it once, use it forever!

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

Re: how to add a new formula with JSL？

I am stuck with a simialr issue. I perform division operation in one column and then need to transpose the table.Running into issue while I try to do this.

```
dtIn << New Column("Max Size ",Character,format("best",8),Formula(
:Name("Max Size") = (2500/:Min Size))
);
//check for empty columns and delete if any
dt = Current Data Table();
names = dt << Get Column Names();
dt1 = dt << Missing Data Pattern(columns(Eval(names)), invisible);
n = N Row(dt1);
For(i = N Col(dt), i >= 1, i--,
If(Col Sum(Column(dt1, i + 3)) < n,
Remove From(names, i)
)
);
Try(dt << delete columns(names));
Close(dt1, nosave);
//Get all coulmn names
allcolnames = dt << get column names(string);
show(allcolnames);
for (i = 1, i <= nitems(allcolnames), i++,
column(dt, allcolnames[i]) << data type(Character,"Nominal");
);
```

But getting an error becuase of the formula -

Cannot convert argument to a number [or matrix] 1 times At rows: 2 Operation: Divide, 2500 / /*###*/:Min Size/*###*/

Formula evaluation errors have been ignored

- Tags:
- @markbailey

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

Re: how to add a new formula with JSL？

I am assuming that you have a pointer to your data table called

dtInput

but not one called

dtIn

Jim

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

Re: how to add a new formula with JSL？

That's a typo. I have pointer to data table called dtIn.