cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

Continue Script

skyzvoir0001
Level III

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