Jump to content

Format a number to dollars in Print output code ?


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

Recommended Posts

Posted

In a layout.. I can make my Number field look like $0.00 fine.. But can't figure.. tried the commands I thought..

my totals look line 10 for $10.00

and 9.5 for $9.50

"Order #" & msg_id & ¶ &

msg_All_Items_c & ¶ &

"Total items $" & msg_SubTot_Order_c & ¶ &

"Discount $" & msg_Tot_Discount_c & ¶ &

"Taxable $" & msg_SubTot_taxable_c & ¶ &

"Tax $" & msg_Tot_Tax_c & ¶ &

"Total Order $" & msg_Tot_Order_c & ¶ & ¶

Posted

@LaRetta, Rod is creating a calc in the parent table that summarizes the records of a child table (that's what he wants to do).

@Rod, where are the numbers not preceded with a "$", because in the above calc, they are--it's part of the label. Are you referring to the field, "msg_All_Items_c"? I recall explaining how you could create a calc in the child table for each line item and then gather them in the parent using List ( ). Is this your "msg_All_Items_c" calc field? Is this the field that does not have the proper number format?

Posted

If I understand your problem correctly, you would like a calculation that will do the work for you to format 9.5 as $9.50.

Here is what I use. I define the following custom function (with FM Advanced) with the function argument named Amount. You can adapt this as you like to implement it directly in your calculation if you don't want to or can't define a function.

-Tom

"$" &

Let(

[cents = 100 * Round(Amount;2);

centString = GetAsText(cents)];

Case(

cents = 0; "0.00";

cents < 10; "0.0" & centString;

cents < 100; "0." & centString;

Left(centString;Length(centString)-2) & "." & Right(centString;2)

)

)

Posted

"$" &

Let(

[cents = 100 * Round(Amount;2);

centString = GetAsText(cents)];

Case(

cents = 0; "0.00";

cents < 10; "0.0" & centString;

cents < 100; "0." & centString;

Left(centString;Length(centString)-2) & "." & Right(centString;2)

)

)

Note that this won't work with negative amounts. If that's OK, you could do the same thing with just:


Let (

amt = Round ( Amount ; 2 )

;

"$" & Int ( amt ) & SerialIncrement ( ".00" ; 100 * Mod ( amt ; 1 ) )

)

Posted

Yes, I agree, and yet he insists. There's another post that dealt with this, in which I suggested reporting from the child table.

Posted

Yes, I couldn't figure.. Thats where I am stuck

I just need to cut a piece of code.. explain what i am doing or showing a hunk of code.. is where my inexperience comes in..

History.. I spent almost 2 years paying programmers to do, and I ran out of monies.. I am figuring most of his code.. I am learning. The economic suck me dry..

Posted

Hi..

I don't know... how far your support goes here... solve some of our.. issues.

Your remembered me previews post here.. I have created a video.. plus a text file attached..

In video, have taken this application and cut off the screens all the other non related items only to show and streamline my problem

Video Link

Some how i think my problems is when I create records in OrderItems, or the portal records... trying to get the ProductInventoryNo from my Inventory file setting the key relationship field

Can attach my source files?

Thank for your consideration... My app is actually done... except for this one item.

Well you know!

problem.txt

Posted

Here is that grabportal zip back you sent me.. I have added my Inventory file.. and some notes in the layout Order... Is the closes thing to what I am having problems with..

Sorry// I just lurked all the forurm just can 'nt seem to get Hoq a list showing one thing will pop other fields in my OrderItems?

sept14-RodM.ZIP

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