Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Check this out :

Where "Index" = 3

FM 6 : 10^((Index-1)*7) WORKS! = Returns "100,000,000,000,000"

FM 7 : 10^((Index-1)*7) FAILS! = Returns "1.0e+14"

FM 7 : 9^((Index-1)*7) WORKS = Returns "22,876,792,454,961"

Are there any maths bofins out there who understand why it no longer works in FM 7?

Posted

Hey Shadow, thanks, I get the reasoning for the resulting formula, I just don't understand WHY FM is behaving like a $1 two battery calculator and freaking out after the 13th digit, I can actually get it to DISPLAY the 100,000,000,000,000 , BUT when you click IN that field up comes "1.0e+14", and this thing worked perfectly in FM 6? The whole formula is used to generate "0" 's so I can substitute them with blank spaces ( " " ) to emulate tabs in a report that must stack or indent hierarchically.

i.e.

Where Index Level = 3

Substitute(Right(10^((Index Level - 1)*7) ; ((Index Level - 1)*7)) ; "0";" ")

and

10^((Index Level - 1)*7 returns 1.0e+14 (AND SHOULD BE 100,000,000,000,000)

but

9^((Index Level - 1)*7 returns 22,876,792,454,961

can you dig . . .

PS and I AM using FM 7.0.2.....

Posted

(sigh) I suppose there ARE other ways around this problem it's just that I get stuck on 'why the world is not a perfect place' sometimes and FM 7 is SUPPOSED to work it out like FM 6 did, besides I use it this way 'cos I need a LOT of spaces to fleshing out the number to a power and then converting the "0" 's BACK to spaces . . .

Posted

Do you have FM Developer 7, if so you could write a simple Custom Function to return a text string of spaces of whatever length you liked. One I have written is given below, it is called "RepeatingString" and takes 2 parameters (Character; StringLength), and basically returns the "Character" repeated "StringLength" number of times, just use the following calc

If ( (Length ( Character ) = 1) and (GetAsNumber ( StringLength ) = StringLength) and (StringLength > 0) ;

Character & RepeatingString ( Character ; StringLength - 1 ) ; "" )

Note the function checks that the Character is of length 1, and that the StringLength is a number greater than 0.

The function is recursive and so calls itself until it can return the right answer, generally I've found this to work very efficiently.

You would use

Set Field ["ListOfSpaces"; "RepeatingString(" "; Index)"]

Or even use this to write your own

"RepeatingSpaces(NoOfSpaces)"

function

Matt

This topic is 7410 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
×
×
  • Create New...

Important Information

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