Subscribe Bookmark RSS Feed

Classification Formula in JSL Based on Descriptions

SirBWhite

New Contributor

Joined:

Aug 2, 2017

Hi,

I’m trying to automate the classification of steps based on the description for a series of items. Attached is an example table looking at different meals and the steps it takes to complete each one with a description associated with each step.

  

I would like to generate a script in JSL to classify each step based on where it is relative to the ‘eat’ step. If it is before the 'eat' step it should be called ‘Prep’, the eat step will be ‘Eating’, and anything after ‘eat’ will be ‘Clean’.  I’ve tried nested 'If' statements, but I can’t figure out how to link the Step to the Description Column. The "Manual Fill of Type" column is what I'm trying to get from JSL.

 

Thank You!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is a formula for the column called "Type(Prep,Eating,Clean)" that will create the values you desire:

If( Row() == 1 | :Step == 1,
	what = "Prep";
	Flag = 0;
);
If( Flag == 1,
	what = "Clean"
);
If( :Description == "Eat",
	what = "Eating";
	Flag = 1;
);
what;
Jim
3 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is a formula for the column called "Type(Prep,Eating,Clean)" that will create the values you desire:

If( Row() == 1 | :Step == 1,
	what = "Prep";
	Flag = 0;
);
If( Flag == 1,
	what = "Clean"
);
If( :Description == "Eat",
	what = "Eating";
	Flag = 1;
);
what;
Jim
SirBWhite

New Contributor

Joined:

Aug 2, 2017

Thanks Jim! This Perfect!!!
dale_lehman

Community Trekker

Joined:

Jan 29, 2015

And, for those of you (maybe just me) who don't prefer to script, you can use the Recode option under Columns to achieve the same result.