Jump to content

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

Recommended Posts

Posted

Hi guys,

I understand how to format a number field. What my problem is when i then include it in a calc it seems to be dropping a lot of the formatting. An example follows

field: LoanAmt

number entry: 5200

formatted entry: 5,200.00

in my calc i have:

If(Loan = "Yes", "This contract is subject to finance in the amount of $" & NumToText(LoanAmt) & " from " & LoanLender & " approval of which is due by " & DateToText (LoanAppDueDate), "") & If(SpecialConditions <> "", "" & SpecialConditions, "")

My problem is when the number is a .00 it just puts in the number with no decimal or thousands separator. i.e 2.56 works fine. 2.00 does not and only puts in 2, likewise 5000.56 but it should be 5,000.56

Even if i type in the comma and the decimal it ignores it in the calc. The other thing i guess is to change the number field to a text field ... and that will work fine in the calc, but it wont' format the field if the user types it in as 5000

Posted

Ah, yes. I remember it well.

Make it stop! Make it stop! Dear God, please MAKE IT STOP!

crazy.gif

Posted

I was afraid of that too Bob, and I'm not sure it may be easy here too as he wants the "," to separate thousands...

Let see if this would work :

Case(TextToNum(NumberText)>1000,

Left(NumberText,Length(Int(NumberText / 1000))) & "," & Middle(Int(Round(ABS(NumberText), 2)),Length(Int(NumberText / 1000))+1,14) & "."& FIN(100+MOD(Round(ABS(NumberText)*100,0),100),2),Int(Round(ABS(NumberText), 2))& "."& FIN(100+MOD(Round(ABS(NumberText)*100,0),100),2))

So that 152489.896 ==> 152,489.90

Largely isnpired by the thread you mentionned, that had ruined my week-end grin.gif

Please all, say it again...STOP. tongue.gif

Posted

I thought somewhere near the end of the thread, Dj had posted a method that handled the thousand separator. Does this mean I have to go back and read the whole thing over again? Aaaaaahhh!

Posted

This is a bit simpler but only works with non-negative numbers:

Case( Int(NumberEntry/1000), Int(NumberEntry/1000)&","&Right("000"&Mod( Int(NumberEntry),1000),3),Mod( Int(NumberEntry),1000) ) & "." &

Right("00"&Round((NumberEntry-Int(NumberEntry))*100,0),2)

Also, it only puts in one comma. If the number is bigger than 999,999.99, then the formula needs to be modified to add another comma.

Here we go again.

Posted

Somewhere near the end ?

You mean the 4th page I had never read before...

These ^ just make me sick

Case(TextToNum(NumberText)>1000,

Left(NumberText,Length(Int(NumberText / 1000))) & "," & Middle(Int(Round(ABS(NumberText), 2)),Length(Int(NumberText / 1000))+1,14) & "."& Right(100+MOD(Round(ABS(NumberText)*100,0),100),2),Int(Round(ABS(NumberText), 2))& "."& Right(100+MOD(Round(ABS(NumberText)*100,0),100),2))

just replaced the "FIN" which is Right() in French

Posted

oh no did i open up a can of whoop ass.. lol grin.gif

Thanks guys i'll read up when I get back to work in the morning. Such a simple thing really you'd think fmp would deal with it...

The secret to finding stuff on this forum is knowing the keywords to search for!

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