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!

Print array problem in crystal report

Status
Not open for further replies.

TedLiu

Programmer
Sep 6, 2002
187
CA
Hi,

I'm using CR10 and CE10.

I have a simple array to get summary data, but the way it display on report seems different with regular numeric data.

e.g.

My numeric data should display as below:

100
0
100-

My Array formula:

StringVar Array Split_LossPaid := [100, 0, -100];

Join(Splie_LossPaid, chr(13));

display on report:

100
0
100-

I understand I need to use string to display array, but when I try to manage to display it as numeric value by adding space behind the postive value, it doesn't work.

If I can not display as numeric value, I may have to change to using subreport which is not good choice regarding performance concern.

Any other ways to workaround it?

Thanks,

Ted



 
Shouldn't the array look like:

StringVar Array Split_LossPaid := ["100 ","0 ","100-"];
Join(Split_LossPaid, chr(13));

If you format the result using a nonproportional font like Courier, the alignment should be correct.

-LB
 
Hi LB,

Thanks for your reply.

It tried with your suggestion, but seems didn't work either. And, you are right, the format should be:

StringVar Array Split_LossPaid := ["100", "0", "100-"];

I'm really not sure how to make it work.

Ted
 
You need to add the space (as follows) after "100 " and "0 ". See my example. And then format the formula to Courier.

-LB
 
No luck too.

I did explicitly add a space behind any positive number and tried your way.

Crystal always ignores the space if it is the last character.

Ted
 
I tested this and it works here. Did you change the font? Proportional fonts will not work.

-LB
 
Hi LB,

Same, still doesn't work.

What's your email, I can send you a screenshot of the report, you will see.

thanks,

Ted
 
It's forum policy to stay in the forum. Please copy and paste your formula into the post.

-LB
 
Hi LB,

Thanks for your reply. Blow is my formula to add a space behind.


@display

WhilePrintingRecords;
StringVar Array Split_LossPaid;
NumberVar i;

For i := 1 to Ubound(Split_LossPaid)
Do(
If ToNumber(Split_LossPaid) >= 0 then
Split_LossPaid := Split_LossPaid + space(1)
else
Split_LossPaid := Split_LossPaid;
)
;

Join(Split_LossPaid, CHR(13));


and I tried Courier (W1) and Courier New with no luck.

IS there anything I missed?

Thanks,

Ted
 
Hi LB,

The problem has been solved by adding a cross-tab into my group footer and it does what I need.

Still don't know why we have different outputs, but at least I can move on.

Thanks for your time and patient.

Ted
 
Ted,

I used your formula and still get the correct results, assuming that the fields in the array appear as "100","0","-100". Not sure why we are getting different results. At least you found a solution.

-LB
 
Hi LB,

The negative value needs to be displayed as "100-" in the report, that means it occupies one more charactoer space but positive value doesn't not, that's also why I add a space behind in my formula.

Thanks,

Ted



 
I understand that--I meant that the initial array (before adding your for-do clause which adds the necessary spaces) should look like that.

-LB
 
I think the initial array should be:

StringVar Array Split_LossPaid := ["100", "0", "100-"] too,

because the array was generated by adding up the detail values to be the grouping sum amount to display, and in my options of report, my default setting for number is "100-" for negative value, when I convert it to string, it automatically display as "100-" without re-formatted by code.

Thanks,

Ted

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top