New line return in Crystal Report - crystal-reports

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.

Related

Format hyperlinks that span multiple lines

I have an Access database (Screenshot is attached) in which the text of an editor is stored line by line in the DB (called StoryLine column). I have the problem that URLs are stored as hypertext "URL" display names. Sometimes only hyperlinks are displayed in one line and the "URL" goes over several lines and then the display name is displayed.
Thank you very much for your help and hints.
I have merged all entries (with Formula) that are assigned to the same entry (all connected texts have the same StoryID). The problem is that the formatting is completely lost.
Only the display text of the URL should be displayed, if it exists, otherwise the complete URL.
HYPERLINK "http://votetandem.org" votetandem.org
should be
voteandem.org (formatted as Hyperlink)
and
HYPERLINK enter link description here
Acquista ora i
biglietti!
should be
Acquista ora i biglietti! (formatted as Hyperlink)
If I understand your question correctly, the below should work for you;
Create a Formula and type the desired text and hyperlink using the HTML tag like:
Insert the Formula Field on the report. Right click on the "Formula Field" inserted on the report, and select "Format Field"
In the "Format Editor" window, select the tab "Paragraph". For the option "Text Interpretation", select "HTML Text"
Note that the SAP Hyperlink text displayed above is the actual hyperlink and selectable by the user. In your case, it may be a matter of just doing option 3 from above on the required fields. I don't know your current structure of the report to give you an exact answer.
Concat Strings
Create a formula with something as such. I haven't tested this so it may need some tweaking.
if {Command_Main.StoryLinesK} in ['45','46','47', '48',''49] then {Command_Main.StoryLine} & "" & {Command_Main.StoryLine}

How to show and hide a LineObject by using formula in crystal report?

I'm using a Crystal Report connected with VB.NET 2010, here I using a Line object, which I need to show or hide depending on data field. Where do I need to set the formula?
This project I use is running with SQL 2008 and VB.NET 2010. I've tried some Formula Field for this topic. But the result is not look like that I want to show.
I use the following code on Formula Field:-
IF isNull({PrintParticularList.CUST_INVOICE_No}) or {PrintParticularList.CUST_INVOICE_No}=""
THEN
""
ELSE
"--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
I also try this following Code :-
IF isNull({PrintParticularList.SLNO}) or {PrintParticularList.CUST_INVOICE_No}=""
THEN
Line25.Suppress=True
ELSE
Line25.Suppress=False
But here I got error on Line25.
A number, currency amount,boolean, date, time, date-time, or string is
expected here.
In the Report Designer use the Insert Line tool to draw the line where you want it to appear on your report. The right-click the line object and select "Format Line..." to open the Format Editor dialog box. On this window you will find a check box labeled "Suppress" with an X-2 button to the right. Click the X-2 button and this will open a Formula Workshop window where you will enter the formula that determines if this drawing object should be suppressed or not.
I would recommend the following formula based upon your previous attempts at creating one.
IF isNull({PrintParticularList.SLNO}) or {PrintParticularList.CUST_INVOICE_No}="" THEN
True
ELSE
False
-----EDIT-----
Since you don't have the X-2 button I have 2 more ideas.
1.) Take the 1 section you current have and split it into 3 sections. Then you could place all the content above the line in the first section, place the line in the second section, and the content below the line in the third section. They use the formula to suppress the second section when the line is not needed.
2.) Insert a blank text box in place of the line and set either the top or bottom border of the text box to a single line. Then use the suppress formula to determine if the text box should be shown or hidden.

How to remove empty space after last row when using Can Grow option on text fields in Crystal Report?

I have a report displaying rows with text fields with variable length (I use the Can Grow option). I use a Box for the details. My problem is that when the last text field cannot fit into to the box on the bottom of the page, a empty space is left, and the new row begins on next page. Unchecking the option Keep Object Together on the fields, didn't solve the problem and if it did I don't want the content of the text field to break across pages.
My question is: Is it possible to auto-re-size box height depending on rows content, so I can avoid empty spaces at the bottom on every page (doesn't look very nice).
Thanks in advance.
There are three things I can think of that might help.
As you said, you can limit the maximum size of a "can grow" field. To the right of the can grow checkbox (in CR designer) there is a "Maximum number of lines" value that defaults to 0 (no limit). You can set that to however many lines you like.
The details section itself has a setting for "keep together" too -- right-click the details section label and go to the section expert. If you uncheck it there the details section will start on the bottom of the page and continue on the next one.
Look at the page footer section, it is printed at the bottom of each page, and if it is large, it takes away from the available space for the data. Group footers, if you have any, could give you the same problem.

Crystal Reports: Displaying a record if another record is null, and vice versa

I am building a subreport and have two tables from which I am using one field each containing a phone number.
Original Number {TABLE1.ORG}
Temporary Number {TABLE2.TEM}
What I want:
If {TABLE2.TEM} is not null, then hide {TABLE1.ORG}, else show {TABLE1.ORG}
I tried to use the above as a formula but it doesn't work too Since these both fields are from two different tables if place them next to each other (without any formulas or suppression) in the design mode:
{TABLE1.ORG} {TABLE2.TEM}
...I see them on different lines in preview mode:
+971 4 321321321
+971 4 123123123
Maybe because the formula reads records and evaluate from the same line, I guess this is the reason why above is not working correctly.
It's not obvious why the two fields are appearing on different lines in preview mode, but it's unlikely to be because they are from different tables - it's more likely to be because there isn't enough room in the layout for them both to display in one line, and so they are growing to a size that canb be displayed.
To conditionally suppress {TABLE1.ORG} based on whether the other field is not null:
right-click on {TABLE1.ORG} and select Format Field...
in the Common tab within the Format Editor dialog, click on the conditional suppress formula button x-2 and enter the formula not IsNull ({TABLE2.TEM}) in the Format Formula Editor.
click Save and close to exit from the Format Formula Editor, then click OK to exit the Format Editor dialog.
If you now preview the report, you should find that {TABLE1.ORG} is suppressed where {TABLE2.TEM} is not null.
Note that if you make display of both fields conditional on whether the other is null, then both will be suppressed where neither is null.

How to handle variable width FieldObjects in Crystal Reports

I have a Crystal Report which is viewed via a CrystalReportViewer control on an .aspx page (using VS2008).
The report has two data-driven FieldObjects (which can contain a variable number of chars) which I would like to display on the same line beside each other.
Problem is when the text in the first FieldObject is too long it overlaps the text in the second FieldObject.
I have tried setting the 'CanGrow=True' and 'MaxNumberOfLines=1' on the first FieldObject to 'push' the second FieldObject further to the right, but this didn't work.
How do I get the second FieldObject to always display immediately after the first FieldObject regardless of the length of the text in the first?
Cheers in advance of any knowledge you can drop.
you can add a text object to the report. And while editing the text of the text object, drag the field you want to show from the object explorer into the text box. Then hit space, then drag the second field in to the same text box. Your two fields will always be one space a part. You could, of course, add more spaces or any other text you want.
Or you can create a function which returns field1 + " " + field2 and add the function to the report.