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!

Aligning problems within memo field when printing 1

Status
Not open for further replies.

Pablito9

IS-IT--Management
Jan 1, 2006
22
NL
Hi,

I'm having problems trying to align phrases within a memo field. But I really don't know of this is possible to resolve.

The memo field contains the description/information of a part that the end user is able to modify or to add.
What I would like to achieve is that all text as from the colon :)) will be aligned at the same position when printing using a variable width font.

This example contains all possible options that the end user could write/modify, only the number of lines could vary.

-----This is the contents of the field
Exterior Sport Appearance.

Exterior Features
Wheelbase [in] :107.1
Length [in]:188.1
Height [in] :55.8
Width - Excluding Mirrors [in] :73.9

Package includes a sport tape stripe on the lower rocker
panels and on the rear decklid spoiler.

Exterior Features:
Width - Including Mirrors [in] :80.1
Front Track [in] :62.3
Rear Track [in] :62.9

Additional comments

-----end memo field

-----This is the contents of the field how I would like it to be displayed
Exterior Sport Appearance.

Exterior Features:
Wheelbase [in] :107.1
Length [in] :188.1
Height [in] :55.8
Width - Excluding Mirrors [in] :73.9

Package includes a sport tape stripe on the lower rocker
panels and on the rear decklid spoiler.

Exterior Features:
Width - Including Mirrors [in] :80.1
Front Track [in] :62.3
Rear Track [in] :62.9

Additional comments

-----end memo field

Once again I have no idea how to do this but if the above example is impossible maybe you have suggestions how content of the memo should be in order to have the right alignment.

Any help or suggestions will be greatly appreciated !!!

Note - Im using CR 2008

Thanks,

Pablito9
 
//{@Column1}:
stringvar x := {table.memo};
stringvar array y := split(x,chr(13));
numbervar i;
numbervar j := ubound(y);
redim preserve y[j];
stringvar array z;
stringvar k := "";
if not("Features" in y) then
z := split(y,":") else
z := y;
if ubound(z) > 1 then
k := k + z[1] + chr(13) else
k := k + y + chr(13);
if ubound(z) > 1 then
m := m + ":"+z[2] + chr(13) else
m := m + chr(13)
);
k

//{@Column2}:
evaluateafter({@Column1});
stringvar m;

Format each formula to "can grow". Format {@Column2} to right justification. Then drop the formulas into a text box to ensure alignment.

The formula containing "Features" was a simple of way of preventing the colon after "Features" from appearing in the second column--not sure if there are other instances of this.

-LB
 
Many thanks LBASS for your reply I really appreciate it,

Because until today there where no reply's I've been struggling trying to do it myself at the end I succeed.

Nevertheless your formula is more simple than mine and I would like to use it, but I'm receiving the error message; "A number, currency amount, boolean, date, time is expected here." which I'm not able to resolve.

Is it possible for you to revise the formula?

Never though I was able to solve this problem, I haven't any programing experience but this how I did it.

//{@_array}:
WhilePrintingRecords;

StringVar array ntrs := Split({PODetail.Calc_DtLineDesc},chr(13));
StringVar array dblpnt := Split({PODetail.Calc_DtLineDesc},":");
StringVar zmr;


//{@kolom1}:
EvaluateAfter({@_array});
WhilePrintingRecords;
StringVar array ntrs;
StringVar array dblpnt;

StringVar vld1 := "";

NumberVar tlr3 := Ubound(ntrs);
NumberVar tlr2 := 0;

NumberVar tlr1 := 2;

if InStrRev (ntrs[1],":" ) > 0 then StringVar tkst := dblpnt[1]
else StringVar tkst := ntrs[1];

while tlr1 <= tlr3
Do
(
if Ubound(ntrs) > tlr2 then vld1:= ntrs[tlr1];
if InStrRev (vld1,":" ) > 0 then tkst := tkst + chr(13) + (split(vld1, ":")[1])
else tkst := tkst + chr(13) + ntrs[tlr1];
tlr2 := tlr2 + 1;
tlr1 := tlr1 + 1;
);
tkst

//{@kolom2}:
Evaluateafter({@_array});
WhilePrintingRecords;
StringVar array ntrs;
StringVar array dblpnt;

StringVar vld1 := "";

NumberVar tlr3 := Ubound(ntrs);
NumberVar tlr2 := 0;

NumberVar tlr1 := 2;

StringVar tkst := "";

if InStrRev (ntrs[1],":" ) > 0 then StringVar tkst := tkst + Mid (ntrs[1],(InStrRev (ntrs[1],":" ))) ;

While tlr1 <= tlr3
Do
(
if Ubound(ntrs) > tlr2 then vld1:= ntrs[tlr1];
if InStrRev (vld1,":" ) > 0 then tkst := tkst + chr(13) + Mid (vld1,(InStrRev (vld1,":" ))) else tkst := tkst + chr(13) ;

tlr2 := tlr2 + 1;
tlr1 := tlr1 + 1;
);

tkst

Thanks
Pablito9
 
The only place I think you could that error in my formula is in the first line. It should be:

stringvar x := {PODetail.Calc_DtLineDesc};

...but if your formula is working the way you like, you should just use that.

-LB

 

I only have changed the
stringvar x := {table.memo};
to
stringvar x := {PODetail.Calc_DtLineDesc};

I'm getting the message at the beginning of:
m := m + ":"+z[2] + chr(13) else


The reason I would like to use your formula is because your are using less lines to achieve the same result! and also because I would like to understand your formula.

Thanks

Pablito9
 
I actually displayed {@Column1} incorrectly. It should be:

stringvar x := {PODetail.Calc_DtLineDesc};
stringvar array y := split(x,chr(13));
numbervar i;
numbervar j := ubound(y);
redim preserve y[j];
stringvar array z;
stringvar k := "";
stringvar m := "";
for i := 1 to j do(
redim preserve z[2];
if not("Features" in y) then
z := split(y,":") else
z := y;
if ubound(z) > 1 then
k := k + z[1] + chr(13) else
k := k + y + chr(13);
if ubound(z) > 1 then
m := m + ":"+z[2] + chr(13) else
m := m + chr(13)
);
k

The x variable is in there just because I typed in your sample memo field to test. You could just omit the x variable and start with:

stringvar array y := split({PODetail.Calc_DtLineDesc},chr(13));

-LB
 
Great, this working fine now.

Thank you very much.

Pablito9
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top