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

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

Recommended Posts

Posted

I'm writing out some values to a text file in a FileMaker script, I would like the Number fields to be formatted like I have in my layout, where there is a decimal point a fixed number of digits following it.

Is there a function that takes a number and makes it as text with this kind of formatting?

Posted

Hi wplate:

There are ways to format Numbers for exporting (calculations, custom functions), but you may not have to go that far.

In FM8, the Export Records dialog box (menu or script step) has an option to Apply current layout's data formatting to exported data. So, if you can run your export from the formatted layout, that might be all you need! Or, create a layout dedicated for Exporting, where all of the Export's fields are formatted just the way you like.

Let us know how it turns out. If that doesn't do the trick, what type of Number formatting do you need ... monetary or something else?

P.S. Hear it's flooding in that neck of the woods. You and yours all right, I pray.

Posted

Flooding? Yes and it is incredible. Thankfully we're all ok.

I'm afraid the suggestion to use export records won't help me. My scripts are populating a couple of fields that are used as the body of an email to be sent out via AppleScript and Entourage.

This morning I had the thought that I could run this calculation in my script...

"Amount = $" &

If (

Left ( Right ( ( NUMBER * -1) ; 3 ) ; 1 ) = "." ;

NUMBER ;

NUMBER & ".00" )

...I added this into my script and it seems to work since a number is either going to have a decimal point and "cents" or it is going to be a whole number with no decimal. So if the third character from the right isn't a decimal point, I need to add the ".00". BTW, I'm assured that if there IS a decimal point in my number, there will only be two digits to the right of it.

Is there a better way to do this?

Posted

Hey wplate!

Glad you folks are okay. Don't risk low-water crossings ... "Turn Around. Don't Drown!"

I can't say if there's a "better" way, but the link below will lead to some other ways.

Lee Smith contributed a helpful post back in the Spring in this "Convert number to text for currency" thread. Hopefully you'll find it useful.

Sorry the Export Records approach can't be applied in this case. I felt lucky for a bit. :sorrysign:

Posted

Right, 5.10 could come out as 5.1 and that wouldn't be good.

I'll try to make sense of the suggestions on the page you suggested. Thank you!

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