Jump to content

Loops


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

Recommended Posts

I have problems with loops, and try and avoid them, but they soon catch up with you. So I need a little help.

I have a database, and the three fields this script is dealing with are

1. Quote price

2. Deposit paid

3. Deposit paid by – pop-up menu with cash, visa etc.

I have created a script like this (Each an IF statement)

1.Check to see if “deposit paid” and “deposit paid by” are empty. If yes massage to check if user forgot to add deposit amount, or OK to continue.

2.Check if “deposit paid” valid and “deposit paid by” not empty. If “deposit paid by” empty user directed to select “deposit paid by” type, as you can not have a “deposit paid” amount and no “deposit paid by” selected.

3.As above but “deposit paid” not empty.

4.Check if “deposit paid” is greater than “Quote price” - choice to then change “quote price” amount or “deposit paid” amount.

OK here it is, I want to loop, do I loop the whole script, or each individual statement?

Trevor

Link to comment
Share on other sites

It's not clear why you need a loop. Also, how is this script triggered?

Is it because you are trying to process a set of records?

Or is it because you're trying to catch each of these errors, and want to ensure that it triggers for each time the user fails to enter the required values?

If the former, yes, a loop would probably be necessary. If the latter, you have a number of options open to you. I have seen the use of a combined calculation to simultaneously test multiple fields, or you might set the individual fields to be required. The combined calc might look like:

IsEmpty(Deposit Paid) + IsEmpty(Deposit Paid By) + (Deposit Paid > Quote Price)

Then you test the value of this; anything greater than 0 indicates an error.

David

Link to comment
Share on other sites

This topic is 5783 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.