Hi Everybody, It’s good to be back. I know it’s been a long break but was badly stuck. Now, You must be thinking what a strange topic header but I just couldn’t think of anything better and let’s not waste more of your precious time with pleasantries and get straight to the point.
In this post I am talking about a requirement that somebody asked me long back.
I have written a code to process a set of records. It includes a while loop and NextRecord function to traverse through those records and perform a set of operations on those records.
Here is a pseudo code of what I am trying to do
This is usually how we write the code to process the records but in case if an error occurs in the loop then execution stops immediately and control goes to Catch and then Finally block.
Now the requirement is to process all the records irrespective of the fact an error occured or not. In other words , if an error occurs log the error and go on to process next record as usual don’t stop.
Sound’s simple enough!! How can I do that???
This is the big question that we need to answer. So, keeping up with old tradition I am leaving this question unanswered and waiting for your ideas/thoughts/answers on this. I will be answering this question on Friday Morning EST (You know where I am right now 🙂 ).
So, what are you waiting for ???
Sorry, for update in delay but have been stuck with forum problem and haven’t found anything to work yet. I don’t want to mess up the data that is why it taking longer than it should.
sukumar432, sebastian1, Thomas Müller have given the right answer to the question.
We need to use Nested Try Catch Statements. I know it sounds simple to experienced guys but it is not as simple for person relatively new to Siebel. Pseudo Code to accomplish has already been given in comments but I will give it here also.
// log error
//recFound = NextRecord
//error Occured I am out of here
//nullify the objects