Normal Topic Printstring questions (Read 1417 times)
magicfish
Member
*
Offline



Posts: 47
Joined: Mar 18th, 2011
Printstring questions
May 6th, 2011 at 6:40pm
Print Post Print Post  
I am using Mass Update to print invoice forms and I need some advice to get the final details right.
In the form, my dollar amounts show as $1,234.99.
Printstring(Amount1, 725, 350, 0, "Arial", 14, 0) prints out 1234.9900 left justified. How do I get the dollar amounts to print out right justified and with a dollar sign, comma and two decimal places?

The date in the form shows as May 6, 2011, but Printstring(Inv_Date, 725, 125, 0, "Arial", 14, 0) prints out 2011/05/06. How do I change the format in Printstring?
Thanks
Glenn
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Printstring questions
Reply #1 - May 6th, 2011 at 7:13pm
Print Post Print Post  
Someone may have a better answer for you, but the command @AsFormattedByLE() may be your answer, as it will format your data to appear as it does in the form LE:

Code
Select All
Printstring(@AsFormattedByLE(Inv_Date,0,Inv_Date), 725, 125, 0, "Arial", 14, 0) 



This is off the top of my head, so you may need to tweak that to make it work.

Good luck!

Steve
  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Printstring questions
Reply #2 - May 6th, 2011 at 7:43pm
Print Post Print Post  
Hello Glenn,

Steve's suggestion for using @AsFormattedByLE() is spot on if you are using Sesame version 2.x to do the formatting.

To right align the values, again in version 2.x, you will want to use the alignment argument of PrintString

Code
Select All
Printstring(@AsFormattedByLE(Inv_Date,0,Inv_Date), 650, 125, 150, "Arial", 14, 0, PRINTSTRING_ALIGN_RIGHT)  



Note: You need to specify a Width when using ALIGN_RIGHT or ALIGN_CENTER.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
magicfish
Member
*
Offline



Posts: 47
Joined: Mar 18th, 2011
Re: Printstring questions
Reply #3 - May 6th, 2011 at 7:49pm
Print Post Print Post  
Thanks Steve,
That worked for formatting the date and currency.
Do you know how I use Printstring_align_right?
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Printstring questions
Reply #4 - May 6th, 2011 at 8:18pm
Print Post Print Post  
Glenn,

Ray solved the alignment issue in his post a few minutes ago. Scroll up.  Wink

  
Back to top
IP Logged
 
magicfish
Member
*
Offline



Posts: 47
Joined: Mar 18th, 2011
Re: Printstring questions
Reply #5 - May 6th, 2011 at 8:21pm
Print Post Print Post  
Ray,
I get unknown identifier at line 25, position 81: [identifier: printstring_align_right] when I do that.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Printstring questions
Reply #6 - May 6th, 2011 at 9:06pm
Print Post Print Post  
Hello Glenn,

In Global Code put the following line

Code
Select All
#Include "sbasic_include.sbas" 



Test again and the error should go away.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
magicfish
Member
*
Offline



Posts: 47
Joined: Mar 18th, 2011
Re: Printstring questions
Reply #7 - May 10th, 2011 at 7:22pm
Print Post Print Post  
Thanks Ray,
That and playing around with the width did the trick.
This is the first time I've had a chance getting back to this. Only being able to work on this an hour or two at a time is a real pain.

  
Back to top
 
IP Logged