Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fromat multiple fileds into MEMO

Status
Not open for further replies.

foxuser

Programmer
May 23, 2000
11
US
Alignment problem

I am converting old check printing routine (fox 2.6) to VFP , where top portion is invoice # and amount and more then one record per line .

InvoiceXXXXX Amt$$$$.$$ InvoiceXXXXX Amt$$$$.$$ .........

main body comes from different table.

before sending to report I have memo field which gets all the line of invoices with the amount. but no matter what I do to format, transform(amt,'9,999,999.99') there is always a spacing problem, which means next line with different amount wont align.
(only way it works if I use transform(amt,@L) which pad's zeros.)

old routine had @ x,x say has always worked to put the field where you want.

thanks in advance for any solutions.


 
If you are using a VFP Report Form, you still might get "a spacing problem"

The Font used is typically the cause of this.
Some fonts are Proportional and others are Non-Proportional.
Proportional fonts vary in width so the amount of vertical space 99999 might take could be different than 11111 would take.
Non-Proportional fonts all take the exact same width no mater what the character. The issue with using this is that sometimes the space between adjacent characters looks odd.

By using a VFP Report Form and then setting the Alignment for the Textboxes which would display each value in each line item, you can create columns which have at least one side lining up with those above and below.

I would not acquire the line item info from a Memo field.
Instead I would have each line item in its own record and then display all of the line items within a Detail Band on the VFP Report Form.

And the data for each line item would be in its own field within the record so that it could be displayed in a Report Form Textbox.

Something like:
Code:
SELECT *;
   FROM InvcMaster;
   WHERE BETWEEN(Invoice, nFirstInvc, nLastInvc);
   INTO CURSOR InvcHdr READWRITE

SELECT InvcHdr
INDEX ON Invoice TAG Invc

SELECT InvcDetail
SET RELATION TO Invoice INTO InvcHdr
SET FILTER !EMPTY(InvcHdr.Invoice)

REPORT FORM InvcRpt NOCONSOLE TO PRINTER

Good Luck,
JRB-Bldr
 
thanks, I suspected the font but did not tried - I changed the font of my top portion to Courier (which is MonoSpace) and every thing worked with my original code.

Thanks again for reminding font type.
 
Well hopefully part of your migration from FP2.6 to VFP includes getting rid of the reports using @ x,x say

While the old way will still work, why limit yourself so much.
Use the VFP Report forms instead.

Good Luck,
JRB-Bldr
 
Foxuser,

I'm glad you've found a solution, but I have to say it's not an ideal one.

By using a solution that relies on a fixed-pitch font, you are restricting yourself to a very narrow choice of fonts. More importantly, users nowadays tend not to like fixed-pitch fonts because they have an old-fashioned typewriter-like look.

As JRB-Bldr rightly says, the root of the problem is that the various fields in the invoice header are contained in a single memo field. It's not the amount that's the problem, but the other fields, such as the invoice number, which presumably contains characters other than digits. It is these other values that are affecting the alignment of the values to their right, which includes the amount fields.

It would be better to split these values into separate fields. You could then position each field exactly where you want it on the page, and its alignment would not be affected by earlier fields on the same line.

You would still use TRANSFORM() to right-justify the amount within the space you give it, but you would not have to restrict yourself to a fixed-pitch font.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Another solution that I have used to be able to space columns of expanding "memo" report fields is to create a separate memo field for each column in the detail band cursor record and populate the column memo fields instead of populating 1 spaced memo field. All of the columns expand to the same number of lines and you can format the spacing of the columns and use different fonts if so desired.

Andy Snyder
SnyAc Software Services Hyperware Inc. a division of AmTech Software
 
Thanks all , as far as using @ x,x say it was in the old 2.6 , I am using VFP report, as I mentioned it is check printing and had multiple records per line which was gathered and put into memo field and then send one record for check to VFP report. I will look into different approach also.
 
You don't need a memo field for multiple rows in a report!

Use two cursors: one with a single record containing the data to print the check, but the other with all of the detail rows for the stub portion.

Put your repeating rows in the detail band, and use the page footer band for the "print once" data.
 
Mine is like check in middle - top stub to give, check in the middle and bottom for us to keep and information is same as top portion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top