Jump to content

Loops and Subscripts


This topic is 7164 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Morning all -

I have a script that is not looping correctly.

I don't want to have to type it all in - so I will attempt to tell you what it does.

I am finding finance charges on payment plan invoices that need to be posted.

The first part of the script turns error capture on and then preforms a find using set fields. Now if the Find finds nothing I tell it to exit script. That's probably my first mistake - so do I need to create a loop for the find?

After the Find I have it go to the first found record and pull the needed information out of it and then it goes and creates a new invoice for the finance charge. This works find. But this is all in a loop and right before the Next Record step - I have it preforming the sub-script to go and do the invoice (which is in a different database.) If I take the subscript out - the script runs fine and does its Find and marks the records accordingly. But as soon as I add the sub-script step - it just does the first record and then exits the script.

Any ideas? Thanks for the help - I am heading back to bed sick - but will check back later this afternoon.

Link to comment
Share on other sites

You don't have to type in the whole script for us, but can you outline it a little more? Especially any statements that have to do with starting and stopping and loops and IF. E.g. is this it so far...

Loop

..Error Capture

..{do Find}

..If {nothing found}

....Exit Script

..End If

.."pull the needed information" ?

-------

Perform Script(External, Invoices)

..New Record

-------

.."marks the records" ?

End Loop

Is it something to do with looping back to the Find after you've marked the records? A good way to troubleshoot this is to insert Pause Script steps all over the place. Then print the scipt(s) out so you can check off each Pause as you go through, and once you've nailed it down, take out the Pauses.

Link to comment
Share on other sites

"I have it preforming the sub-script to go and do the invoice (which is in a different database.) If I take the subscript out - the script runs fine and does its Find and marks the records accordingly."

When your subscript has "done the invoice" is it then returned to the original script so that it may continue?

Link to comment
Share on other sites

This topic is 7164 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.