Choose Language Hide Translation Bar

Steal This Code! Three Upgrades for Scripts Obtained from the Enhanced Log (2021-US-45MP-870)

Invited Paper Winner


Level: Intermediate


Jordan Hiller, JMP Senior Systems Engineer, SAS


JMP 16 made us all coders. With Action Recording in the Enhanced Log, point-and-click data work can now be saved as a replayable script. Learn some intermediate JSL techniques to future-proof your captured code, making it more general, more robust, and easier to use. After a brief review of basic JSL syntax, we discuss case studies illustrating three techniques:

  1. Using loops to perform actions on many columns at once.
  2. Extracting numeric values from a JMP report, for reuse later.
  3. Allowing users to specify data files or columns at run time.



Auto-generated transcript...




Jordan Hiller Hi, everybody. I'm Jordan Hiller and this talk is Steal This Code! Three Upgrades for Scripts Obtained from the Enhanced Log.
  And here's the inspiration for this talk. It's a book by Abbie Hoffman, a provocateur and activist. Yeah, he named his book, Steal this Book, which is a great title. Not sure it's a great business plan to name your book that, but anyway it's it's very catchy.
  So why steal this code? JMP wants you to steal code. The idea is that you point and click and do your analysis in JMP,
  and that code behind your point and click is saved. It's saved in the enhanced log and you can grab it and reuse it.
  And that's about 90% of your production script. You're going to grab that and reuse it so that you can
  automate common tasks and do it with a click of one button, instead of a sequence of point and clicks. So that's the whole goal here, you're going to save
  script from the enhanced log and that's the the bones, the skeleton of your production script.
  There's about 10% left over that you need to write yourself, and that's our goal for this talk. We're going to talk about some of that connective tissue that holds production scripts together.
  So in this talk, I'm going to focus with you, you know, not so much on the on the nitty gritty of the syntax,
  much more on the big picture, and that's in line with what I think is a good way to learn JSL programming. It's much better to take existing code and learn by example. Use that code.
  Find that snippet that does what you want to do. You're going to find it on the JMP user Community or maybe in the scripting guide.
  And just copy it and adapt it for your use. You don't have to know all the complexities of the syntax. You'll get really far that way. Learning the syntax comes along as you gain experience.
  So we're going to talk about three case studies about things you can do to enhance your code from the enhanced log, but first let's do a review of JSL. Maybe it's an introduction to some JSL basics for some of you.
  So the important thing for you to know about JSL if you're starting out is that everything is an object. Everything that you
  want to do something to is an object, so that includes data tables and columns in data tables, and platforms, like the distribution platform, graph builder, Fit Y by X,
  and the reports that come from those platforms. So when you have objects, the way that you operate on them, is you send them messages. So objects receive messages. Here's a really simple example that I copied from the enhanced log.
  Open the Big Class data table in the sample data directory and run a simple distribution analysis, right. And this is what that code looks like, just copied from the log.
  What we want to do, the first thing we want to do is name the data table. Give it a name, and for that I took the code from line five over here and I enhanced it. I
  added this bctable= before the rest of it, before the open part of the statement, all right. And what that does is, as we open that data table, we create this name, bctable. You know, I chose bctable, you'll see dt in the documentation. Use what you want, this is assigned by you.
  So let's run this by highlighting it and clicking the run button, opening Big Class and simultaneously assigning the name bctable. Now the virtue of doing that, why is it important, it's because now I have this
  handle. It's a hook I can use in the code later, bctable. Whenever I say bctable I'm talking about Big Class.
  here's the next line, but distribution command, and I have modified that too. And you know, before here from the log that's a naked distribution command. It doesn't have...
  it's not pointing at a data table. When you run it this way, JMP will just run it on the data table that has focus,
  the current data table, that happens to be big class, because you opened it just before that, okay. But it's always good to be explicit. It's a good idea to explicitly say which data table you want to operate on, so we'll run it this way.
  bctable, and then the double arrows and then the distribution commands. So that's what we've added, bctable with the double arrows.
  And this is the syntax for sending a message. So we're sending the distribution message on the right to the data table, that bctable is named for, on the left. And you can see that that's Big Class when I hover over bctable. So running the whole thing,
  we get the distribution report
  that we wanted.
  Now here's...we can take this a step further and, often, we need to do this. We're going to create a name for the platform as we run it, so
  here's a line that incorporates both the double arrow and the equals, alright. So so let's uh...let's read this from the right to the left. We're going to take that distribution message and send it to the bctable.
  And the result of all that, which is the platform, we're going to save in this variable I'm calling distplat.
  Let's run that.
  All right, looks the same, but the difference is now I have this this JSL variable distplat that I can use later on in my code.
  What would you use it for? You might use it to add red triangle options to the output, so here let's let's bring that...
  let's bring that distribution report where you can see it.
  And we're going to take that distplat object, that's the...that's the distribution platform.
  See, hovering over it, and let's run this line. Turn on the normal quintile plot in the distribution platform. There it is.
  Last step is to take the platform, to take this object here, and to
  get a report from it, a report object. That's this line. Send the report message to the platform object, and now we get a report object.
  And we need to do this if you want to access these values in your code -- any numbers or graph or graphical elements in the in the report -- you'll need this, okay. This object rdistplat. So just running it one more time, rdistplat.
  I ran it and you don't see anything visibly, but what happened is now I have this object, rdistplat. It says it's a display box, and later on we're going to talk about how you can use that to access numbers here in the report.
  Okay I'm going to clear my log
  and start with our
  case studies.
  So the first technique that we're going to learn is repeating the same command over and over on different columns in the data table, iterating over columns with loops using the for each command. So
  this is a really common need, sometimes it's just something simple that you need to do, like changing the format or the modeling type of a column.
  It could be very complex like
  taking a...taking a transform of the column and running a control chart and doing something with that control chart. So yeah, it scales; this technique scales.
  Here's how we're going to achieve this in JSL code. We'll point and click first, right, do what we want to do. Do it for a single column, and then we're going to grab that code using the enhanced log,
  and then that's the skeleton of our script. And we're going to modify it in order to loop over all the columns that we want to perform that action on.
  The method we're going to use for for looping, for iterating, is is for each, and that was introduced in JMP 16, so this technique is not going to work in earlier versions of JMP.
  This also uses a concept called JSL lists, so we're going to talk about that a little bit too.
  Okay, I am going to start
  in JMP, let me start at the home window.
  And I'm going to...let me just check the log, make sure it's clean. No, I got to remove one thing, clear the log. Okay, so let's point and click what we want to do. I'm going to open a data table called sc20.
  This data table is available to you in the presentation materials that you'll find online.
  And looking at this data table, it has an ID column and then it has about 20
  columns of data. These have many, many decimal places, too much precision and I want to truncate it at two decimal places. So let's change the format so we're only showing the first two decimal places of data.
  That's a simple point and click operation. Right click, go into the column info,
  and we'll change the display format from the default best to fix decimal with two places.
  OK, and now we did that for NPN1, we have 19 other columns we'd like to do that for, as well.
  So let's examine the enhanced log.
  And this is it, this is the code that we need to achieve that changing the format for one column, NPN1, right. And then to reuse this, go to the red triangle, and you can save the script either to your clipboard or even to a new script window.
  I'm going to switch to another file, where I've done some work and so we can dig into this a little bit more.
  So the first two lines here...three lines, this is the code from the log. All right, the first thing we're doing is we're opening the data table.
  And you might have noticed that I've edited a little bit, I edited out my long path name, my long directory path to this file.
  If you run it this way,
  it will work as long as the JMP data table, sc20, is in the same directory as this JSL file. So that's just like a local file path to this same directory that you're currently in.
  So anyway, from the log we're just opening the data table, and then we are here, applying that format change, fixed decimal 10 characters two decimals.
  The table...the column reference over here on the left is one way to address a column. There are several different ways, but this is a very common one you'll see with the colon. Table ref...ref...reference on the left side of the colon and the column name on the right side of the colon.
  So this is again directly from the log.
  JMP is using this way in the log to address the data table. I think it's better to do what we talked about, it's better to give the JSL name as you open it, and then use that JSL name going forward. So instead of this business before the colon, I changed it to dt.
  So here's that same code, just...just fixed a little bit, and when I run it, yeah, it has the right effect. It opens the data table and it
  changes the format to two decimal places. Okay so yeah, now that we have that, it's a pretty easy thing to
  change all the 19 other columns, right.'s NPN1, and then I can just copy that line and change everyone and write it 19 more times.
  Yeah, of course that's inefficient, and one of the great things about programming is is you don't have to do the same thing more than once, right. So that becomes easier to maintain if we...if we just write this once, instead of writing it 19 times, 20 times.
  So here's how we do that. The first thing that we do is we're going to get a list of all the columns that we want to operate on.
  And when I say a list, I don't mean just a generic kind of list. I'm talking about a JSL list, I'm talking about a particular data structure that you use when you're programming in JSL.
  A list is just a couple of objects contained in a container and that's how we use it. So here are three ways to create a list of column objects.
  The first way is to is to do it manually, is to just type everything. So if I was to run this,
  three table reference...three column references, NPN1, PNP1, PNP2.
  Note the curly braces both in my code and also when I hover over that CNames variable. When you see those curly variable...those curly braces, you know you're dealing with the list in JSL.
  Okay, so that's one way to get a list. Let's talk about a couple of other ways. This is the one we're going to use for this example, ultimately. This is
  saying, hey, get all of the continuous columns in my current data table, well in the data table I name here, dt. So message object, create a new list.
  So let's run this one.
  And now if I hover over CNames, you'll see that's what we want. That's the list of all 20 that we want to operate on.
  Okay, and the last way you can do this is, you can let the user select which columns in the data table. That looks like this. I'm just going to select two. Let's select IVP and PNP4, two columns selected.
  And if I run this,
  we get a list with just those two selected columns from the data table.
  All right, so, however, you get that list, the next job is to apply that formatting line to each of the items in the list, and that's called looping or iterating.
  So here's the old way to do it. It uses the for command in JMP. That's what you'd do before JMP 16 and I put it here, for your reference in case you're still on JMP 15. But,
  you know, it's a little bit complicated and forbidding looking for new users, so there's a much more compact and readable thing you can do if you're using a list in JMP 16. If I want to repeat an action on every element of a list, I can use this for each command.
  All right, and let's let's look at it and and see what it's doing. It's taking three arguments, the arguments are separated by commas, we'll take them right to left.
  The last argument is that format command, right, applying the format, and instead of doing it for dt NPN1, instead of doing it for one column, I put a placeholder here and I chose list item; you choose what you want.
  Right, this is just a word, a variable name, you you choose it. I chose list item. So that's our placeholder, and this is the command that we want to run on each item of the list. Which list? This list, okay. So that's our list, that's the second
  argument. And then the first argument is the placeholder, right. It tells us that we're we're using that placeholder to hold the values of the things in the list.
  It's in curly braces, so make sure you use that if you if you reuse this code.
  So this is what the whole thing looks like, instead of 20 plus lines of code, I just have, well three lines of code, and that includes opening the data table,
  getting a list of column names, and then repeating it...repeating that action for all 20 continuous columns. To run the whole thing, o you see what it looks like.
  And there it is. Now each of these columns
  has two decimal places displayed in the format.
  Okay, so that was a very simple example of of using for each to do something very simple on
  on a column.
  Let me show you a slightly more interesting example.
  Here's an example where, for the same data set, for sc20,
  I'm going to make a control chart for every column, and I'm going to append those control charts to a journal and save the whole darn thing out as a as a PDF, okay. So
  it's using the same for each, and it has the same first two arguments, you know, list item is first, a list name for the second. But now I have lots of code as the third the third argument in for each.
  So here we go. Let's run this whole script.
  Opening, running a bunch of control charts, slapping them together in a journal. And now, if I look out on my desktop, I've created this thing, my report.pdf, that has all of those control charts, page one, and their page breaks to separate them. So page one, page two, page three.
  So you can look at this example too on your own time. It's included in the presentation materials.
  Okay, and that is our first technique that we're talking about. Let's clear the log for our next technique.
  Okay, extracting a value from a report. This happens a lot in JSL. You do some sort of analysis, maybe it's a distribution, maybe it's a regression, you need to
  get something, collect something out of there. Maybe it's a mean or median. Maybe it's a slope coefficient from the regression or a P value.
  So that's our job, and the tricky part about this is, reports have a hierarchical, highly nested structure, and it can be a little bit tricky to travel down that hierarchy, travel down that tree to just find exactly what we want. So I'm going to teach you a trick.
  The trick is we're going to point and click our way through the analysis, like usual, and then the thing we want to grab,
  I'm going to change the text color to red, just a minor formatting change. And then, when we save that script to the log, we'll use that to learn how to address that red item
  in JSL. So let's let's go through that together.
  Back in JMP again.
  I'm going to open Big Class, good old Big Class and let's run a distribution on the height column.
  All right, here's my distribution report that I want to extract something from. Let's say it's the median, in this case the median is 63, and I'm going to put that into a JSL variable so that I can reuse it later, and you know write with it or do some math on it or something like that.
  Here's the trick to find out how to address that number 63.
  Change the color or, you know, the font or whatever of this thing that I want to grab. So how to do that if you've never seen this, this is worth knowing.
  There's a button on the toolbar for properties, I believe that's a new button in JMP 16.
  So if you turn on the properties for this report.
  We can travel down this tree and find what it is that we need. So look at this.
  number col box, right. And note that when I click on different parts of the report, the the corresponding
  item, the kind of display box it is, is highlighted in the properties panel.
  Okay, so we can see that this thing that has all these results is a number col box with all these numbers in it and, like, I told you we're just going to take this thing, and I'm going to change the text color to red.
  Just like that.
  Now I'm going to close the properties panel.
  There's the report, and let's send this script to the enhanced log.
  Red triangle, save script to the log.
  And now viewing that log.
  This is the part we want. It has, you know, the distribution command with the part that changes the text color of that median and those other statistics to red. So let's look at that in a little bit more detail now.
  Okay, so here is that code...same code from the enhanced log. I just copied it here and I formatted it a little bit, so we can talk more about what we need.
  So the whole reason we did this was to get this part, which we're now going to interpret, all right. It uses send to report and, within that, dispatch.
  And we're going to really focus in here on the four arguments to dispatch. We need the first three, the fourth argument is changing the color, that's really not what we're interested in. We're interested in addressing the display box, the element that we want, okay. So
  this first argument is navigation. It tells us, go down to display boxes, these are actually outlined boxes, go down to outline boxes
  here. So let's look at that report. Again I'm sure you've noticed in JMP that in a report you have these levels of nesting, right, and I have just a...
  an outer outline box distribution. Within that is an outline box height and, within that is an outline box quantiles, and inside that quantiles one is the is the stuff I need to extract.
  So that's what it's telling me. It's telling me to walk down that tree. I just needed the height and quantiles and that's going to identify it for us.
  Good. The next two arguments tell us something about about this...this element that we're trying, that we turned red. It tells us...the third one says what it is, it's a number col box, we saw that in the properties.
  And the second argument tells us the title
  of that number col box. This one's blank. This one doesn't have a title and that's okay. We can...we can still use this information to get at that data, so sometimes you'll see a title here, sometimes you won't.
  Okay, now that we have this, we're going to take that information and we're going to use it
  to extract the median.
  Here's the code that does it. It starts here on line 23 and it goes through line 29.
  We're opening the data table again,
  naming the distribution, performing the continuous distribution.
  You'll note that we don't have any of that dispatch and and send to report, that's because we don't need to turn it red in our production script.
  So yeah, perform the distribution analysis, name the platform.
  This is important, you have're accessing the report layer. You're extracting it with this line, so that's creating rdist, this report object.
  And then, this is the line where the magic happens. This is where we're grabbing that
  that median value, assigning it to the JSL variable, mdn, and for this one, we're going to write it to the log. So I'm going to tell you a little bit more about this, but first let's just run it once altogether, so you see what it does.
  I'm going to run line 23, whoops, let's do it this way instead. Let's run line...lines 23 through 29.
  Performed the distribution. It's not red and we extracted the median, it is now stored in mdn, you can see that the value for that variable is 63.
  median is 63. Perfect.
  So here's that line where we're extracting the
  the median value, that number 63 from the report.
  Let's let's look at that. I'm just going to call this up here so that we can
  refer to this, as we, as we do it.
  So here's that line. It's just again organized, so that we can we can look at each element separately.
  63, the median value from the report.
  Here's how we get to that.
  This is called subscript...subscriptinig. When you see the square brackets in JSL code, that means that your subscripting an object. That object is a container of some sort, either display boxes,
  often a list. You can subscript lists this way as well. So what we're doing is, yes we're extracting nested items in this report object.
  The first thing we're going to is the height outline box. You remember that, and then from there we're going down to the quantiles box, you remember that.
  And now we're in the right place. We just have to grab what we want, what we want is the number col box, right, and because it didn't have
  a title that we could use (that was that was up here, no title), instead we're referring to it by number. It's the first number col box in that quantiles outline box.
  So you might look at this and say to yourself, well wait a minute, there's there's numbers over here. That's that's a number col box too, isn't it? No, actually it's not. It's a string col box, and remember, you can check all that stuff if you want to. That's, again, from the properties.
  And if I click into here,
  number col box, string col box, string col box. See them over here? String...string number, so it's the first number col box.
  And that's going to grab all of these numbers.
  Okay, the very last thing we need to do is is this subscript. Subscripting this way says, get me the sixth element...1, 2, 3, 4, 5, 6. That's the median; it's 63. And when we run this line, that subscripts the report; it grabs that median, so that we can reuse it later.
  So there's a how to grab something from a report. I have another example that I'll share in the presentation materials that will have
  an element that does have a title and you can see, you can use that as a model to do your own work on, if you run into that situation.
  All right, the last thing we're going to discuss is how to get input from your user, the person who's running the script.
  And let them choose what file they're going to analyze or even what column in data table they're going to analyze. So this is maybe the most common
  thing that that beginning scripters want to do. You know, I've set up my script to do something on one column, and I want to give something to other people in my organization
  to let them do it themselves on different data, right. So if you...if you generalize your scripts this way to let your users choose either a file or a column, or both,
  you're generalizing your script and you're greatly increasing its value. You're going to give it to other people in your organization. They can replicate your work and do it quickly without going through all the clicks.
  Okay, so in this section, it's less of a case study and more of a laundry list. We're going...I'm going to show you three methods that you can let your users choose files and two methods that you can use to let them choose columns.
  And we'll start with the methods to choose files. As usual, we'll begin by doing something in the log and then copying that. Here''s what it looks like when you open Big Class, you just get this in the log, open Big Class.
  dt. I'm using dt in this case, and so, when I open Big Class,
  now it has...dt is pointing at Big Class, okay. And then I would go on with my production script, right.
  Here's the thing, to let your user choose which file they want, all that we need to do is, we need to find a way to let dt point at something else.
  Write the rest of your script, use dt, and then at the beginning, you can change this. dt is no longer just pointing at Big Class; it's going to point at something else.
  Alright, and that's something else is determined by the user,
  the person running the script. Okay, here's the easiest thing that you can do, I think, is you can use this line instead of opening a data table. If you use this at the beginning of your script to assign dt,
  what that means is that JMP is going to run this script and it'll give that dt
  name to whatever data table is in front.
  So from the user perspective, what they do is open a data table, I'm going to open sc20 here, and make sc20
  my current data table. See that up here? That what's listed in in this window is the current data table.
  And so, if your user opens a data table and then runs the script and then encounters this line, dt is now going to point at sc20.
  So that's a pretty powerful method. The problem with it is it requires your user to know exactly what to do. They have to know that they have to open the data file first and then run the script.
  We can do something a little bit more robust. We can show them a file chooser when they run the script, so that they can navigate through their directory structure and find the right file to open.
  It turns out that this is dead simple to do. What you do is you just get rid of all the stuff in here, you get rid of the reference to Big Class, and you just say open with no argument at all.
  And when JSL tries...when JMP tries to interpret this line, it says, okay, user wants to open something, but I have no idea what. Let's show them a file chooser so they can decide.
  So let's...let's run this. dt = open.
  Run the script. Here's your generic file chooser and from my desktop, I'm going to open Iris.
  Iris is open, and of course, it has the dt name.
  all JMP files, all files, right. It could be showing a lot of stuff in here.
  So if you need more control, oops, if you need more control over
  the choices that your user's going to make, instead of using open, we'll use something called pick file.
  Pick file is a command that has a couple of different options. I'm only using three of them.
  Let's go through this example. So the first three arguments for pick file are a title you'll see in the chooser window,
  a directory where the chooser will start, and a filter that tells you which files you can open from that chooser, right. So let's run this...this line, this this section of code, the pick file command, saving the result in PF.
  Run that.
  Okay, note that that's that argument over here, select excel file. That's what we see up here in the window title.
  The folder, the path in the second argument, that's where it starts.
  And the third bit, the the file filter that says, hey, only show the user excel files to open, that's down here. I am not allowed to change away from excel files. I'm restricted to excel files.
  So let's let's say sandwiches, and click open.
  Well, wait a minute, why didn't it open?
  Well, let's let's check. PF equals pick file. What's PF? Ah, PF is the path to the thing that we want to open. We haven't issued the open command yet. Pick file doesn't open a file, it just picks a file.
  So to to close the circle, here's what we have to do. Create our table reference by opening the
  PF variable, which points at the file we want, the excel file we want.
  There it is. That opens the sandwiches data table, and now I have my dt and I'm ready to go on with my script, just like I wanted to.
  Let me pause here to show you something important. Pick file, if you encounter something like this and you don't know all the arguments and you want to learn more, a couple of things. First of all, you get a little
  hover help, a little pop up that has some information about the syntax. Here's a better option. Right click on it in the in the script window,
  and you can look it up in the scripting index. The scripting index is a very important tool for any JSL programmer, and
  it has the command you're looking up. It has the list of arguments, some explanatory text, and really importantly, it has a couple of examples that you can run through and see what it does. So, if I just run this example here, it's going to give me a pick file.
  Well, it sent me somewhere someplace I don't want to go.
  Let's just close it.
  Right and then we can we can experiment and grab this code, steal this code and use it in our script if we want to.
  Okay that's the that's the scripting index. It is also available from the help menu. Scripting menu...look stuff up there.
  current data table, a naked open, or a pick file. There are other ways too, but those are three good ones to start with.
  Now let's talk about letting your users choose what column they want to operate on.
  Here I am...I have something copied from the log. I opened a data table called prices. and I made a graph on it showing the price of apples over time.
  I'm not going to show you the the point and click part, I'm just going to run the script. I think you know how to extract script from the enhanced log already, so let's just see what the script does. Opens prices and there's my graph, apples versus date, price of apples over time.
  So look at this data table, prices, yeah there's apples, but I also have all these guys too, right. So what if I want to let my user tell me what graph they want to see, which column they want to see graphed.
  That's what this section is about, letting...letting your users choose.
  So we'll discuss two methods. Here's the first one.
  It's it's operating on columns that the user has selected.
  And and we've seen this before, we saw this syntax earlier, I think, in the in our second case study. Yeah, this is how we make a list
  that contains the the columns that are selected in the data table. So let me go back to that data table.
  I'm going to select, maybe three columns and
  let's run
  this. Actually I think I should I should run dt. Let's run both of these.
  chicken, coffee, and eggs.
  All right.
  Which one do I want to operate on? Well you know how to operate, how to iterate over a list using a loop, but we're not doing that. I'm just going to use a shortcut. I'm going to say look,
  if my user selected more than one, just just graph the first one for them. So my user has selected chicken, coffee, and eggs before running the script. I just want to give them the graph on chicken.
  Right, so that's the next line here. There's our subscripting. We're subscripting the CNames list to get the first item.
  So we'll run this.
  Now I have that nice variable, my col,
  that has the first item from the list, chicken, the column reference with the colon.
  And now we can run our graph builder. Now we can go on with our life, the only difference is we've substituted where it was apples up here,
  that is now my col. That's the only change we've made and so running this, we're going to get a graph of the price of chicken.
  Alright, so that's one way, but again, like we talked about earlier, this requires on the user knowing what they have to do. This requires...
  method requires that the user has to know that they got to open the data table, select this, and then run the script, and that's a bit of a hassle. So
  instead it's a little bit more robust to show a column chooser dialogue to the user at runtime. Here's what that looks like. The syntax is a little bit complex. I'm not going to get into all the details, talking about it at a high level. We're opening the data table just as before.
  We're using this command called column dialogue
  to surface a chooser...column chooser to the user.
  Again, it has a lot of arguments. I'm only using a couple. What I'm doing is I'm saying, hey, give me a button that says choose commodity, and the user can choose one column for that at max and they have to choose at least one.
  So here, let's let's run run this script starting at line 60.
  Opening price, here's my dialogue and look what it what a rich dialogue I have for very little code. That's the virtue of this column dialogue that we're using. So I am going to have coffee as my selection and click OK.
  Good. Back to the script, we just ran this line.
  And it's the result of our choosing is stored in dlg. Let's take a look at that.
  All right, that's a little complicated. It says dlg is is a list, see the curly brackets, and I got some nested curly brackets, so it's it's like nested lists.
  Here's the subscripting that gets you there. I'm not going to spend a lot of time explaining this, but you can copy this code if you...if you need to do this. So to get from dialogue to get just the part that says coffee, a column reference to coffee there,
  here's the subscripting to make my col, so run this line.
  And now, my col contains just that reference to the coffee column, and and this is identical to before. We run the graph builder using
  my col, substituting it for apples and so we get coffee or whatever else the user has chosen.
  Okay, that is everything I wanted to share with you. I'm just going to close with a little bit of advice for anybody who's getting started out this way with JSL programming.
  The advice is, you know, let JMP right your code, as much of it as possible. And that's what the enhanced log is for, steal that code from the log. That's most of your script,
  and then you just have to write the connective tissue, the parts that hold stuff together and makes it into a usable production script. You can steal that code too. You're going to steal it from the scripting index, you can certainly steal from this presentation.
  All the materials are with this presentation and you can also steal from the JSL cookbook in the JMP User Community, a fantastic resource that has many common JSL tasks and gives you the code you need to accomplish those things.
  And again, I'm going to emphasize, really don't sweat the syntax too much. It's just easier to grab the code and substitute what you need. You're not going to break anything, and you will learn the subtleties of this syntax with more experience.
  Thank you very much for your attention.

Thanks for that explanation of the new For Each() function. In the Help > Scripting Index, it looks like there are several methods and examples, going to take some time to get used to it. Your examples really help.

Names Default To Here( 1 );
For Each( {value, index}, {10, 20, 30}, Show( value, index ) );

Thanks, Jordan! This is very helpful.


JSL coding is a perishable skill and your presentation was just the nudge needed to get me and a few others back on track.  Thank you from all of us!