Page 1 of 1

Three Digit Invoice Balance in Mailing Template

PostPosted: Sat Jun 21, 2008 1:39 am
by maidanss
Hi John,

How do I change the number format for the invoice balance to revert to three digits and a different currency sign than Dollar in a new template in mailing.

PostPosted: Sat Jun 21, 2008 8:26 am
by John Sindelar
For the currency symbol, edit the field "z_MMemberMessageMergedCalc" in the Mailing Members table. The auto enter calc here is where all the actual merging happens.

You'll see that whenever we use a currency field like "<<Contact Balance>>" or "<<Invoice Amount>>" we employ a custom function to format the number. The currency symbol is sent to this custom function as a parameter, so just replace "$" with whatever you need. Be sure to do this for each instance of the SeedCode_AddDollarFormat function used in that calc.

When it comes to "reverting to 3 digits" I'm not completely sure what you mean. If you want the numbers in the mailing to have 3 digits to the right of the decimal, instead of 2, edit the custom function "SeedCode_AddDollarFormat", replacing the meat of the function with this version:

Code: Select all
Let ( [
Amount = Round ( NumberField ; 3 ) ;
A = Int ( Amount ) + 0 ;
L = Length ( A ) ;
R = If ( Amount ≠ A ; Left ( amount - A & "000" ; 4 ) ; ".000" )
] ;
CurrencySymbol & Case (
L=9 ; Left(A;3) &","& Middle(A;4;3) &","& Right(A;3) ;
L=8 ; Left(A;2) &","& Middle(A;3;3) &","& Right(A;3) ;
L=7 ; Left(A;1) &","& Middle(A;2;3) &","& Right(A;3) ;
L=6 ; Left(A;3) &","& Right(A;3) ;
L=5 ; Left(A;2) &","& Right(A;3) ;
L=4 ; Left(A;1) &","& Right(A;3) ;
A
) //end Case
& R
) //end Let


Let me know if I've misunderstood you.

PostPosted: Sat Jun 21, 2008 9:11 am
by maidanss
Thanks, That worked on the digits to right of the decimal. There are 3 digits now.

I need to change the Currency to read "BD" instead of $, and the date to DD/MMM/YYYY. Thanks.

PostPosted: Sat Jun 21, 2008 11:24 am
by John Sindelar
maidanss wrote:Thanks, That worked on the digits to right of the decimal. There are 3 digits now.

I need to change the Currency to read "BD" instead of $, and the date to DD/MMM/YYYY. Thanks.


Glad it worked.

Instructions for changing the "$" symbol can be found in the post above.

For dates you'll have to edit the auto enter calc field "z_MMemberMessageMergedCalc" in the Mailing Members table, taking apart the date fields to get the format you want. You can use something like this, taking the invoice date as an example:

Code: Select all
[ "<<Invoice Date>>" ; Let ( n =  MailingMemberInvoice::InvDate ; Day ( n ) & "/" & Month ( n ) & "/" & Year ( n ) ) ] ;

PostPosted: Sat Jun 21, 2008 12:07 pm
by maidanss
Thanks,

It all worked like a charm. :P