Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List off command
Message
From
15/09/2008 13:48:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01347593
Message ID:
01347709
Views:
9
>>>>Hi, I have outputted some data to a file for use in a report but the price figure do not align properly and want to know a work around.
>>>>LIST off job_nbr,' ',ALLTRIM(STR(price,10,2)),' ',ALLTRIM(STR(old_price,10,2)),' ',todaydt for g>1
>>>>but ends up looking like this depending on length of price value.
>>>>
>>>>13T001 7.00 6.00 09/15/08
>>>>14T001 137.00 6.00 09/15/08
>>>>15T001 9.00 6.00 09/15/08
>>>>16T001 2.00 6.00 09/15/08
>>>
>>>Well, you just need to use PADR function instead of ALLTRIM(STR( to padr to the number of chars your want and align properly.
>>>
>>>LIST off job_nbr,' ',PADR(price,10),' ',PADR(old_price,10,),' ',todaydt for g>1
>>
>>Ah yes thanks. I just never bothered with that function(til now)
>
>I was also thinking that perhaps you just need to remove ALLTRIM() from your statement. The result would be the same.

And, besides, numbers should be aligned right, so they need to be padded on the left, therefore PADL()... unless we need decimals.

Of course, if we're fine with the field sizes as they are, and the occasionally shifted decimal point when too large a value is crammed into the field, then the LIST command with just plain fields (as Tore suggests) will work just fine.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform