I've got a crystal reports formula that displays a string based on an input
Simplified:
if (a=1) then
"Abc"
else
"Abcdefghijkl"
The problem is that I want this field right aligned. In the "Format Editor" I have set the "Horizontal Alignment" to be "Right", but it hasn't changed the formatting when I run the report.
Any idea's on to solve this?
I pulled up a .rpt of my own and mucked around with it. Does the output have alot of trailing whitespace, i.e. Abc________? If so, a simple trim() could fix it.
where _ is a whitespace. StackOverflow won't let me display whitespaces as white spaces
Related
I have this problem where I want to strikeout a specific text in crystal reports. I mean I do not want to strikeout the entire string in that column I am using crystal reports in visual studio.
Here is the image:
I format the encumbrances column and check the strikeout as shown in the image below:
This next image is i input a script where if the string contains "*" it will strikeout the string. This is not what I wanted. What I want is that strikeout only the strings after the asterisk. I mean all of the strings after the asterisk should be strikeout and all of the strings before the asterisk should not be strikeout.
This is the result using the current script I have. As you can see all of the text is strikeout. What I want is that the text "CANCELLED" should only be strikeout since it is after the asterisk and the text "ANOTHER ENCUMBRANCES" should not be strikeout since it is before the asterisk.
How to solve this problem? Is this possible? I know my script is wrong.
As Crystal Reports can only display one font-style inside one formula field, you have to create two formulas and cut the text in two parts.
Create following formulas and put them inside a text-object.
(On the AfterAsterisk-formula tick the Strikeout-checkmark.)
BeforeAsterisk
If InStr({td_table.ENCUMBRANCES}, "*") > 0 Then
Left({td_table.ENCUMBRANCES}, InStr({td_table.ENCUMBRANCES}, "*")-1)
AfterAsterisk
If InStr({td_table.ENCUMBRANCES}, "*") > 0 Then
Mid({td_table.ENCUMBRANCES}, InStr({td_table.ENCUMBRANCES}, "*"))
I want to import a text from HTML file in Crystal Reports 2008 for our software.
And I tried to make a formula for underline in Crystal to underline my text with dots no matter if the cell in HTML is empty or not. I mention that I search for 4 or 5 hours but nothing useful. Thanks for advice.
For example, i want to use dots to underline the formula for "{denumire_societate}"
Right click on your field and select Format Field
Border tab
Change Bottom -> Dotted
You can optionally create a formula if you want to present Dotted Underline with specific conditions
I want another answer because i want to underline only some words, and i don't wanna put them in separate text box because it will looks unesthetical.
In the picture, i got a text box with many words, formulas, etc, i want to underline a specific one like: {denumire_societate}, {adresa}, {nr_reg_com}, {cui}, {cont}, and the underline to be form by dots.
Text box
I want when my PickUpsCRY is greater than 0,this column is fully disappear else it should be shown .
You can't really suppress horizontal space in the same way you can suppress vertical space (via the suppression of report sections, etc.). So, while you could technically suppress that column's fields, header, lines, etc. with the suppression formula max({table.PicksUpsCRY})>0, you won't be able to get rid of the whitespace and it'll appear as though you've just got a hole in your table.
You could move this column to the end so it's not as obvious that there is a column missing, though.
Im creating a report based on crystal report.. I'm wondering how can i return a new line like for example im a field which is bound to a a datatable where in if the number of text reach the maximum width of the field it would carry to the next line?.
Like if i had a text that is "Representation and other incidental allowances" since it exceeds the width of my field , i want to display like below:
"Representation and other
incidental allowances"
Hope someone could help me!.. Thank you!
Campagnolo_1 says you will need a formula, but I can assure you a formula is not necessary. All you need to do is place your column where you want it, give it the width you want, and right click on the field, select "Format Text", go to the tab labelled "Common" and check the box next to "Can Grow". To the right of this option, you will be able to select how many lines this field can 'grow', in other words, this is how many additional lines the field will use to display your text.
You will have to create a formula in the "Can Grow" option under "Format Field" (right-click on field). You will have to specify after how many characters you'll want the new line, so that could be tricky if your text changes.
How can I remove the comma (,) from crystal report fields?
I have a field name "year" which is having a value of 2012, but when I show that value in crystal report it includes a comma, becoming 2,012.
How can I show only 2012?
In the crystal report designer view:
Right mouse click on that field, and select Format object. Select Custom Style in the Style list, and click Customize. Untick Thousands Separator, and any other unwanted formatting.
Failing that, you could try selecting the field and deleting the "," value from the property ThousandSeperator in your properties window.
try this
for formula
ToText( ToNumber({variable1}), "#" )
Try below code,
Replace (ToText ({Tablename.Year_Field}, 0),"," ,"" )
I'm just guessing but I believe you have embedded your field name into another object such as a text field.
If this is the case, double click your text box in the design view, then select your text field you are having issues with. Right click and select "Text Formatting", under the Font tab click the 'Format Formula Editor' button (the one with the X-2) to the right of the Font drop down menu. Now all you have to do is close the formula editor, then cancel the Text Format window. NOW when you right click on your year field again you will have a new option to Format the field which was previously grayed out.
Alternatively, you can remove your year field from any other object it is nested in. This will give you access to all formatting options.
NumberVar cRed;
ToText (cRed,"#")
OR
ToText({some numeric field value},"#")
The "#" has to be enclosed in parenthesis, single or double.