Subscribe Bookmark RSS Feed

JSL Scripting: How to skip object send to journal if object does not exist

tdk

Community Member

Joined:

Oct 9, 2014

Hello All,

I have an issue where we are running a script off an actively changing data set.  Sometimes graphs will not be generated depending on conditions in the data set.  At the end of the script, I send all graphs to the journal, then save the journal.  However, if a graph does not exist (Because for that week there was no data for it), the script will error because it can't find the object.

Is there a way to say " object <<journal" but if object does not exist, skip this line and continue with the rest of the script?

CAR1 << Journal;

CAR2 << Journal;

CAR3 << Journal;

so CAR1 and CAR3 were both generated in the script as they had data.  CAR2 was not because there was no data this week for CAR2.  Currently, JMP will error out when it try's to send CAR2 to the journal (bc CAR2 does not exist).  How can I get it to skip CAR2 and still continue with the rest of the script.

Thanks for your help!

1 REPLY
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

You could put your <<Journal messages in Try() blocks.

There may be other alternatives too, depending on how you're creating your object. If you'd like more help, post bit of that part of your script and we can make some suggestions.

-Jeff

-Jeff