How to handle variable width FieldObjects in Crystal Reports - 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.

Related

How do I get OpenOffice Writer Combo boxes to display multi-line text?

I am developing an OpenOffice Writer template that can be used to fill in reports for a child-care centre.
There are some standard outcomes, comprising long sentences, and I want the user to be able to select the appropriate sentence from a combo box. I have entered the sentences into a table in Openoffice Base database, which is then connected to a series of combo boxes in a Writer template. However, when the user choose an option that contains a very long sentence, only the text up to the length of the combo box is visible.
What I want to do is have the selected value of the combo-box wrap over several lines when selected so that all the (very long) text appears in the selected box when the user chooses a long sentence from the combo.
I have been looking through the properties of the combo box control, but have yet to identify one that will allow the selected value in the combo box to word-wrap (so that I could make the combo-box several lines in height such that the entire sentence would fit into the box).
Any pointers on how I could do this would be much appreciated.
thanks,
David.
Thanks Jim K, that was helpful. In the end, what I wound up doing was creating a textbox which I named "selectedOutcomeATextBox" immediately below my combo box which was named "OutcomeCombo".
I then attached the following macro code to the textModified event associated with the "selectedOutcomeATextBox":
Sub UpdateOutcomeA
Dim Doc As Object
Dim Form As Object
Dim Ctl As Object
Dim newCtl as Object
Doc = ThisComponent
Form = Doc.DrawPage.Forms.GetByIndex(0)
Ctl = Form.getByName("OutcomeCombo")
newCtl = Form.getByName("selectedOutcomeATextBox")
newCtl.Text = Ctl.Text
End Sub
I also set the "Printable" property of the "OutcomeCombo" to "No", so that when the document prints, the combo box itself does not appear on the printed page, but the "selectedOutcomeATextBox" textbox which has had its value set by the macro when I choose a value from the combo box does appear with the desired text. I also set the "TextType" property of the selectedOutcomeATextBox" text box to "Multi-Line", so that extra long text will wrap to the next line, thereby showing the very long strings that are stored there.
Thanks heaps Jim K.
cheers,
David Buddrige
Apparently combo boxes do not have the MultiLine attribute. The question was asked a few years ago here but was not solved.
One alternative that requires some macro programming is to use a single multi-line text field and then make a scroll bar button that changes the choice. Instead of a scroll bar, two buttons could be used to change the choice (Previous / Next), or even a list box control. Using a list box control in this way would have the advantage that they could see all the choices at once, like a combo box.
Another approach is to break up each sentence and display the parts across several lines of a list box. Then when one line is clicked, all the lines of a sentence are selected at once, using an event listener for the list box. This could be shown in addition to an ordinary editable multi-line text box, in case none of the answers in the list are wanted.
One more idea: Radio buttons can have multiple lines, so dynamically show radio buttons, one for each sentence. A dialog window could be displayed to hold the radio buttons. The result of the dialog would be used to fill the multi-line text field.
Or you could just live with the truncated sentences. Maybe it would help to make the control a little wider, or abbreviate the sentences.

New line return in Crystal Report

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.

SSRS Report parameters - Textarea instead of Textbox

Does anyone know if its possible to create a parameter in SSRS that will display a Textarea instead of a Texbox and let the user type in a few paragraphs of text, including carriage returns?
I've a requirement to create a report that will end up as data with a cover letter. A section of the cover letter needs to have a block of text, which the user can specify when setting the parameters.
I can create a 'text' parameter which displays a Textbox, but that does not accept carriage returns. I have tried to copy and paste text from Word, but then it only takes the first line of text.
Has anyone got any suggestions? So far I've not managed to find any solutions online.
Thanks in advanced.
Sorry problem solved,
I changed the text parameter so that it could accept multiple values. Then on the textbox that displayed the text on the letter I changed the expression to read:
=Join(Parameters!FreeText.Value, vbcrlf)
Sorted.

JasperReports: Subreport properties "Print In First Whole Band"

First sorry for my English - it's not native for me.
I've create report with subreport. Subreport print some records, each textField is surrounded by border (It should look like a table). And when some textField's Height is too large - it breaks and continue to print text on next page - and thats Ok, but the other textField elements in a row are left on previous page - and their borders don't show on new page. This cause the report to look with only alone textField in a row (first row on new page). See attach: Red line - text is carry over to new page. Green markers - text fields left at prev page.
I've tried to use Print In First Whole Band property to avoid row breaking, but Subreport don't react on it. Probably this is JasperReports issue.
Please advice how can I make my report looks fine, without empty spaces instead of borders when starting new page ?

Hide row (and remove whitespace placeholder) of tablix in Reporting Services 2008

I have a row in a tablex that I want to hide based on a condition. I can do this with the visibility property and also using CanShrink as well is an option.
I've tried both of these and the best I can do is hide the row (make it invisible), but it keeps the whitespace it takes up - I need to remove the whitespace too so if it is not shown that it doesn't take up paper/viewing space.
I have also made the height of the row very small and put cangrow=true so that that if i populate the field with data based on an expression it will grow to the right size but this is not ideal because there is still 0.03125in of space for the row that is always shown (minimim height) and if it grows it grows to fit the text but not neccessarily the set size I want.
I thought I had done this before in an older version of RS but I can't seem to get it to work correctly in this version (2008).
Any ideas?
Try to set the Hidden property of the Static Row Group under the Details Group, in this case the whole row will disappear instead of the content of the textboxes.
If you are using Report Builder, you need to switch to Advanced Mode (make sure that the Properties and the Grouping windows are displayed, go to the upper right side of the Grouping window and press the black triangle):
Click on the second "Static" item under the "(Details)" group and you can set the Hidden property on the Properties window.
Link to MSDN sample
A simpler way to get to this option for hiding a row is to right-click on the row header and select "Row Visibility". From there you will get a dialog where to can enter an expression.
I was able to make the rows go away by setting the following 2 properties
textbox.CanShrink
row.Hidden
I played w/ row.HideIfNoRows and it seems to have no effect in accomplishing the desired outcome described by op.
Click on textbox, these one is in the properties of the textbox
(if there are multiple columns, I assume you will have to make this setting for each cell/textbox, in my case, I only had 1 column)
CanShrink=false
For the next property, you have to go into ADVANCED MODE by clicking the down arrow at the right side of the Row Groups/Column Groups pane.
Click on the Row containing the line you would like to hide.
The Hidden property can be found in properties pane...
This is an alternate way to set Hidden, as opposed to right clicking the Row Header in the actual Tablix.
Hidden= <expression describing when you want the row hidden hidden>
One other note - If you right click the Row Header and choose 'Row Visibility' you get a dialgue. the Row Property dialog has a caption "Show or Hide Based on an expression".
The actual behaviour is It will HIDE the row if the expression evaluates to TRUE.
IMHO - this is misleading, at best ambiguous.
Once you understand the property you are actually setting is called HIDDEN, then this makes sense. Until then, I certainly assumed I was setting a property called Visisble... FWIW....
On the empty row you want to hide, go to the text box properties and go to expressions -> visibility, then show or hide based on an expression and use
=iif(first(Fields!.Value = ""),true,false)
Setting row visibility logic is important, but I've learned that sometimes a blank row will still appear, even though its contents are hidden. To solve this, I had to do the following non-intuitive steps, but I did in fact succeed in completely suppressing unwanted white space.
In the cell in the tablix region, use the Insert > Rectangle menu option.
In the rectangle, use the Insert > Textbox menu option. Resize as needed.
In the textbox, right-click and enter a placeholder.
Set the value of the placeholder expression to whatever you need.