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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ToText(x,####)

Status
Not open for further replies.

nvtjellis

Programmer
Mar 6, 2001
24
US
I would like to remove the 0(zero) values in my Array if the entry is not filled from the iterations of the For loop. I've tryed using the as the subscript for the ToText which would (I think) make the number of entries variable. I coded ToText(NewIDs,"#") + ', ' but versiion 8.5 of Crystal report will not accept the in the ToText statement.

Here is the code the feeds the Totext.
WhilePrintingRecords;
NumberVar Qx; NumberVar i;
Numbervar Array NewIDs;
Redim NewIDs [5]; 0;
Global Numbervar Current_ID;
// The maximum number of available unassigned CodeIDs for parents is five.
// The Do increments the current CodeID, and places the new number
// in the next available slot in the array.
// The new CodeID is used in the next For loop iteration, until the maximum
// is reached.
//
If {@Differance} >1 and {@Differance} < 6 then

For i := 1 to {@Differance}
Do
(
NewIDs := (Current_ID + 1);
Current_ID := (NewIDs));
ToText(NewIDs[1],"#") + ', ' +
ToText(NewIDs[2],"#") + ', ' +
ToText(NewIDs[3],"#") + ', ' +
ToText(NewIDs[4],"#") + ', ' +
ToText(NewIDs[5],"#");

This is the current detail lines of the ToText statement:

1004, 1005, 0, 0, 0
1106, 1107, 0, 0, 0
1394, 1395, 0, 0, 0
 
Interesting how people approachj problems, instead of posting what you have and what you need you post what you wrote that doesn't work and what it looks like when it's wrong. Probably could have avoided posting your formula entirely.

If you do post code, post the referenced code as in @difference.

OK, I'll just remove the zeros then...

WhilePrintingRecords;
NumberVar Qx; NumberVar i;
Numbervar Array NewIDs;
Stringvar Output:="";
Redim NewIDs [5]; 0;
Global Numbervar Current_ID;
// The maximum number of available unassigned CodeIDs for parents is five.
// The Do increments the current CodeID, and places the new number
// in the next available slot in the array.
// The new CodeID is used in the next For loop iteration, until the maximum
// is reached.
//
If {@Differance} >1 and {@Differance} < 6 then

For i := 1 to {@Differance}
Do
(
NewIDs := (Current_ID + 1);
Current_ID := (NewIDs)
);
Output:= ToText(NewIDs[1],"#") + ', ' +
ToText(NewIDs[2],"#") + ', ' +
ToText(NewIDs[3],"#") + ', ' +
ToText(NewIDs[4],"#") + ', ' +
ToText(NewIDs[5],"#");
Replace(Output,", 0","")

Have a nice weekend.

-k
 
Thank you for the answer. I sometimes wonder when I provide too much or too little information when seeking help. I think that people using this web site are by far more knowageable than I. I did consider @Differance referance in the code I pasted. Your comment is well taken and I will try to improve on stating my situation provide a more complete discription.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top