cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
skyzvoir0001
Level III

Continue Script

Hi, so i have a main table (main_dt) which i am going to update (update_dt). However, there are times when update_dt is empty. How do i make it such that the script continues  to run? What function do i use for it to continue?

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: Continue Script


@skyzvoir0001 wrote:

Hi, so i have a main table (main_dt) which i am going to update (update_dt). However, there are times when update_dt is empty. How do i make it such that the script continues  to run? What function do i use for it to continue?


There are a number of ways to ensure that your script handles potential problems. Here are two ways that you might deal with your situation of a data table with no rows causing a problem.

 

  1. Try() - The Try() function allows you to attempt something that might not work and recover gracefully. In your case you could surround your << Update() with a Try(). This would allow your script to continue if the << Update() message throws an error.
  2. If() - The If() conditional allows you to test whether a condition is true before executing other statements. So, you can check whether update_dt is empty before doing the <<Update().

When you say that "update_dt is empty," it's not clear whether you mean that the data table doesn't have any rows or that the variable update_dt has no value. Which you mean makes a difference in how you would check for that condition in the If(). If you mean that the data table doesn't have any rows you can use the N Rows() function. Alternatively, the Is Empty() or Is Missing() functions will test whether a JSL variable doesn't have a value. 

-Jeff

View solution in original post

1 REPLY 1
Jeff_Perkinson
Community Manager Community Manager

Re: Continue Script


@skyzvoir0001 wrote:

Hi, so i have a main table (main_dt) which i am going to update (update_dt). However, there are times when update_dt is empty. How do i make it such that the script continues  to run? What function do i use for it to continue?


There are a number of ways to ensure that your script handles potential problems. Here are two ways that you might deal with your situation of a data table with no rows causing a problem.

 

  1. Try() - The Try() function allows you to attempt something that might not work and recover gracefully. In your case you could surround your << Update() with a Try(). This would allow your script to continue if the << Update() message throws an error.
  2. If() - The If() conditional allows you to test whether a condition is true before executing other statements. So, you can check whether update_dt is empty before doing the <<Update().

When you say that "update_dt is empty," it's not clear whether you mean that the data table doesn't have any rows or that the variable update_dt has no value. Which you mean makes a difference in how you would check for that condition in the If(). If you mean that the data table doesn't have any rows you can use the N Rows() function. Alternatively, the Is Empty() or Is Missing() functions will test whether a JSL variable doesn't have a value. 

-Jeff