Problem You need to execute some JSL more than once. Solution Use a for(...) or while(...) or one of the more exotic variations. The for loop is the most common way to repeat some statements.Cars = {"Ford", "Chevy", "Tesla"}; // a list nCars = N Items( Cars ); // notice loop starts at one and <= counts to the end For( iCar…
Problem Suppose you prompt a user to make a selection. When you retrieve the values from the user, typically they are stored in a list. Now you need to select the data that matches the values in the list. Solution The following example demonstrates how you can select rows in a data table that contain any value stored in a…
Problem You need to use a username and password in your script and you use Windows. Solution Call powershell via RunProgram to store the password in the Credential Manager (search for it in the start bar) so you can retrieve it later. Names default to here(1);loadmodule = " if (!(Get-Module -ListAvailable -Name…
Problem You want to use a Slider Box to set a continuous value, and you want to see the current value as you move the slider. Solution Make a Slider Box and a Number Edit Box. Add a script to the Slider Box to update the Number Edit Box. Add a script to the Number Edit Box to update the Slider Box. Eggs = 50;Bacon = 50;New…
Problem You need to build a custom calculator that displays a table of numbers based on several input values. Solution Use Number Edit Boxes to get the values and use the Set Function method to attach JSL to the Number Edit Boxes to recalculate the table when the values are changed. Use a Table Box to hold columns of…
We are in the process of revamping the JSL Cookbook to give it broader appeal, make it better organized, and easier to use. The focus will be on short projects (recipes) to help you improve your JSL. The recipes will include step-by-step instructions, completed code and a demonstration video. The first recipes will focus…
ProblemYou need to insert the value of a variable into an expression without evaluating the whole code. Examples include: * Writing column formulas using a script * Writing scripts using another script Below is a script to transform the selected columns in a table. This does NOT work, because the expression 'cols[i]' is…
ProblemYou need to look at every element in an Associative Array Solutionuse the <<First and <<Next messages // load a table of elementsdt = Open( "https://en.wikipedia.org/wiki/List_of_chemical_elements", HTML Table( 4, Column Names( 2 ), Data Starts( 5 ) ) );// make an associative array using "H" to lookup "Hydrogen" and…
Problem Suppose your data table has a set of rows selected. Now, you want to select rows from that selection that meet an additional condition. Solution The Select Where() message for the Data Table object offers an option that allows you to specify to select from the current selection. The following example demonstrates…
Problem You have some code that you want to call from more than one place, maybe with different arguments. Solution Use a user written function, with parameters, local variables to keep them away from other code, and a return statement to send back an answer. // this example shows how to write a user written function to…
It looks like you're new here. Sign in or register to get started.