@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.
- 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.
- 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