cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
TamedZebra
Level III

JSL: Conditional Check on Grouped Data

For a certain table, I want to determine if the string "CCCC" is contained within elements of column C. Normally, I would expect to use Contains(:C, "CCCC").

However, in this scenario, column C is not just a simple column. I need to determine if "CCCC" exists in column C when column C is grouped by the values in column A and column B, and I need this check to be applied row by row.

When I asked a generative AI, it suggested Group(:A,:B)&Contains(:C,"CCCC"), but this approach didn't work. Currently, I'm stuck with the following JSL script that didn't yield the desired result:

If(
    Group(:A,:B)&Contains(:C,"CCCC"),1,
    0
)
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: JSL: Conditional Check on Grouped Data

If you are able to provide example table, with expected result it makes it usually much faster and easier to provide help. 

I'm not sure if this is what you are looking for (r is the result column)

jthi_0-1770353369882.png

Col Max(Contains(:Column 3, "CCCC") > 0, :Column 1, :Column 2)

Column 1 and Column 2 are the grouping columns and Column 3 has the string

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: JSL: Conditional Check on Grouped Data

If you are able to provide example table, with expected result it makes it usually much faster and easier to provide help. 

I'm not sure if this is what you are looking for (r is the result column)

jthi_0-1770353369882.png

Col Max(Contains(:Column 3, "CCCC") > 0, :Column 1, :Column 2)

Column 1 and Column 2 are the grouping columns and Column 3 has the string

-Jarmo
TamedZebra
Level III

Re: JSL: Conditional Check on Grouped Data

Thank you for your continued support.

The issue has been resolved. 

I regret my own inflexibility. I hope to absorb a great deal of knowledge from this community!Really Thank you!

Recommended Articles