Jump to content

Incremental Loop


zengraft
 Share

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

Recommended Posts

I understand. I'd have to make my calculations work recursively. The number that I want to increment is a divisor that just goes from 1 (+1) to whenever the result is true. It's just much easier to think of this calculation iteratively. I'd put it in a script, but that would probably run slower than using a custom function. The calculation is used for every new record and has a lot of dependencies that get updated.

Link to comment
Share on other sites

Well, "the most simple counter" would be a parameter named counter, initialized to 1.

a divisor that just goes from 1 (+1) to whenever the result is true.

Not sure what that means - couldn't you use the Mod() function to get the result without recursing?

Edited by comment
Link to comment
Share on other sites

Well, "the most simple counter" would be a parameter named counter, initialized to 1.

Not sure what that means - couldn't you use the Mod() function to get the result without recursing?

One of the tests and results in a case() function that I want to apply it to is something like this, where n is the divisor starting from 2, then 3, 4, and so on until it evaluates as true. If there's a remainder, it gets passed on to another calculation field that does something similar, and then a few more times. This is actually part of a slew of calculation fields that deal with remainders of an original input value. Mod() doesn't always give me the proper remainder and that's the first function that I worked with before my idea of using iterative increments.

WSTurnPageSides ≥ PageFit / n ; PageFit / n ;

Link to comment
Share on other sites

I believe the condition:

WSTurnPageSides ≥ PageFit / n 



can be rewritten as:




n ≥ PageFit / WSTurnPageSides



and the smallest integer n that will satisfy the condition can be calculated as =




Ceiling ( PageFit / WSTurnPageSides )

That's working very well so far and it reduces a lot of calculations into one simple line. I wrote the condition like this before but missed the Ceiling() function. Thanks again for your help.

Link to comment
Share on other sites

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