Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Field formatting Post Reply Post New Topic
Page  of 2 Next >>
Author Message
crystallize
Newbie
Newbie


Joined: 25 Jan 2011
Location: Germany
Online Status: Offline
Posts: 7
Quote crystallize Replybullet Topic: Field formatting
    Posted: 25 Jan 2011 at 5:24am
Hey,

I've got a question:

I've got a formula field. It's alignment is set to "right".
I want to print some dates, text, numbers ... with that formula field.
The formula looks like this:

{@Page_Number} + CHR(13)
+
Cstr({DatePrinted}, 'dd.MM.yyyy') + CHR(13)
+
(if (Length(Cstr(SupplierID})) > 0 ) then
Cstr(SupplierID}, '#') + CHR(13))
+
(if (Length(Cstr({CustomerID})) > 0 ) then
Cstr({CustomerID}) + CHR(13))


IMO the result must look like this:
1 of 4
15.01.2009
1234
5678

But it look like this:
1 of 4  
15.01.2009 
1234
5678

I want it to look like the first example.
Can you help me?

Thanks in advance


Edited by crystallize - 25 Jan 2011 at 5:32am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Jan 2011 at 6:02am
you might try and trim the items...
trim({@Page_Number}) + CHR(13)
+
trim(Cstr({DatePrinted}, 'dd.MM.yyyy')) + CHR(13)
+
(if (Length(Cstr(SupplierID})) > 0 ) then
Cstr(SupplierID}, '#') + CHR(13))
+
(if (Length(Cstr({CustomerID})) > 0 ) then
Cstr({CustomerID}) + CHR(13))

IP IP Logged
crystallize
Newbie
Newbie


Joined: 25 Jan 2011
Location: Germany
Online Status: Offline
Posts: 7
Quote crystallize Replybullet Posted: 25 Jan 2011 at 9:44pm
Originally posted by DBlank

you might try and trim the items...
trim({@Page_Number}) + CHR(13)
+
trim(Cstr({DatePrinted}, 'dd.MM.yyyy')) + CHR(13)
+
(if (Length(Cstr(SupplierID})) > 0 ) then
Cstr(SupplierID}, '#') + CHR(13))
+
(if (Length(Cstr({CustomerID})) > 0 ) then
Cstr({CustomerID}) + CHR(13))



Thx for your answer.
I already used "trim" but it changed nothing. Also I tried alot things in the "format editor" of that field.

Any other ideas?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Jan 2011 at 4:17am
I cannot seem to replicate this problem however I replaced
your page number formula with the PageNofM print state property and datePrinted with the PrintDate property.
 
You can also try a text box
and drag and drop the 4 items you want into it with your carriage returns in the text box. Right click on each one and format them the way you want. Then right click on the text box and select format text, select common tab and check 'Suppress Embedded Field Line Blanks" as true. set it to Can grow and then make the box a height of 1 row. 
 


Edited by DBlank - 26 Jan 2011 at 4:17am
IP IP Logged
crystallize
Newbie
Newbie


Joined: 25 Jan 2011
Location: Germany
Online Status: Offline
Posts: 7
Quote crystallize Replybullet Posted: 26 Jan 2011 at 5:28am
Originally posted by DBlank

I cannot seem to replicate this problem however I replaced
your page number formula with the PageNofM print state property and datePrinted with the PrintDate property.
 
You can also try a text box
and drag and drop the 4 items you want into it with your carriage returns in the text box. Right click on each one and format them the way you want. Then right click on the text box and select format text, select common tab and check 'Suppress Embedded Field Line Blanks" as true. set it to Can grow and then make the box a height of 1 row. 
 


Thank you.
I tried it with the textbox, but it's still the same result.

It's not PageNumber-Formula or the DatePrinted-Field. I replaced them with hardcoded data and it's the same result Confused
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Jan 2011 at 5:45am
This is odd. I have seen a few other instances where people did not trim a field and when they right justified assuemd that there were no spaces on the end but not like this. Italmost seems to reading chr(13) as a space and a return.
I would try breaking this down. maybe try each of the fields individually as formula fields or fields dropped into text boxes and see fi they always replicate the problem. If they replicate try trimming on a fomrula field.
Do the individual fields repeat the problem?
IP IP Logged
crystallize
Newbie
Newbie


Joined: 25 Jan 2011
Location: Germany
Online Status: Offline
Posts: 7
Quote crystallize Replybullet Posted: 26 Jan 2011 at 10:02pm
Originally posted by DBlank


maybe try each of the fields individually as formula fields or fields dropped into text boxes and see fi they always replicate the problem. If they replicate try trimming on a fomrula field.
Do the individual fields repeat the problem?


Good morning,

I've tried the following:
First of all i created some formula fields (a formula-field for "{@Page_Number}" and a formula-field for  "Cstr({oSalesDocument_oSalesDocPrintedColl.dtDatePrinted}, 'dd.MM.yyyy')"
and so on.
Put them all into my report, same font/size and their alignment set to right.
Looks fine if I do it this way.

BUT the point is to get them all into one formula or even all formulas in the same textbox. The reason is, if I want to format them (change the font/size, position or other things I want to change only 1 field instead of 6).

Next try I've putted those formula-fields into a textbox...... ye, looks ugly again. Same problem.
I've tried trim, but it changed nothing.

*cry*

Edit:

I've just tried to put those formula-fields into a textbox again. But instead of putting them right into there under each other with a carriage return I've tried to set them in a row. Extended the formula-fields with a "CHR(13)" and tried it out........... damn, still the same ugly result =<



Edited by crystallize - 26 Jan 2011 at 10:10pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Jan 2011 at 4:08am
I was recommending deconstructing your formula as a way to problem solve not necessarily as a final solution, however you do have a solution now if needed even if it is not the desired one.
I find breaking formulas into parts and testing each part a good problem solving process.
I still cannot replicate the issue in my test report (using PageNofM and PrintDate as stand ins for your formula).
What font and font size are you using?
IP IP Logged
crystallize
Newbie
Newbie


Joined: 25 Jan 2011
Location: Germany
Online Status: Offline
Posts: 7
Quote crystallize Replybullet Posted: 27 Jan 2011 at 4:18am
Originally posted by DBlank

What font and font size are you using?


Arial size 9.
I also tried many other (Times new roman, courier new ......)



Edited by crystallize - 27 Jan 2011 at 4:20am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Jan 2011 at 4:27am

So I am interpretting the if statements of supplierID and customerID that you want them to exclude nulls or 0's.

Just to try it,
in the formula editor change the option in the pick list to Use Default values for Nulls and try the formula
(PageNofM + CHR(13))
+
(Cstr(PrintDate, 'dd.MM.yyyy') + CHR(13))
+
(if {SupplierID}> 0 ) then
Cstr({SupplierID},0,'') + CHR(13))
+
(if {CustomerID} > 0 ) then
Cstr({CustomerID},0,'') + CHR(13))


Edited by DBlank - 27 Jan 2011 at 4:27am
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.063 seconds.