hide columns in crystal report at run time? - c#

how to hide columns in crystal report at run time?
thanks for any suggistions.

Option 1: use conditional-suppression logic to hide/show redundant fields
Use a parameter field to drive the suppression formulae for the desired fields.
If you want to eliminate blank spaces between fields, then you'll need to stack the fields on top of each other and suppress them appropriately. In your example, column 2 would contain field2 and field3 (both suppressed) and column 3 would contain field2 and field3 (both suppressed). The suppression logic, in your example, would continue to suppress both fields in column 2, but would show field3 in column 2 (field2 in column 2 would still be suppressed).
Option 2: use 'placeholder' formula field
Each column of data that could be suppressed would be a formula field. Each formula field would use SELECT CASE logic to choose the desired field to display. A 'hidden' field would simply return a null value. Your SELECT CASE logic would be written to ensure that values are filled from left to right. The formatting will need to be done in the formula rather than on the formula field itself.
Option 3: use the SDK to dynamically-change the report.
Use the CR .Net SDK or the older CRAXDRT API to dynamically-modify the columns' visibility and positioning.
If you use this option, however, your deployment options will be more restricted.

You could use parameters (which values can be set during runtime) and use them on the objects' suppress formula.

just for sharing I found a great and simple article at
http://www.codeproject.com/KB/cs/Dynamic_Crystal_Report.aspx
that using parameters in crystal report to dynamically load data from a database into Crystal Report and show specifying which field (Columns of a particular table) should be displayed in the repor according to user choice.
Dani.

Related

SAP B1: How to set LinkedObjectType for existent column in a Matrix?

In our database, User Defined Fields in the Production Order rows define linked Production Orders and Purchase Orders. The columns for these fields on the Production Order window really should have golden link arrows.
If I created the columns myself, I would set the LinkedObjectType properly and the arrows would appear. However, in this case the B1 client creates the columns automatically. I need to get them and add the link arrows after form creation has completed.
The Production Order items grid is a Matrix, which offers the Columns property, so I can retrieve any column I want; however, it is returned as a plain Column object, not an EditTextColumn, so the LinkedObjectType property I need to set is not available. Attempting to cast the Column to an EditTextColumn simply causes an exception.
What is the correct way to add link arrows to a UDF column on the Production Order screen's matrix?
You can update user defied field and set Validation to Linked to entities.

RDLC report TextBox shifts if adjacent TextBox is not visible (I.E. Hidden)

I am using Visual Studio 2012 C# to create reports using the RDLC framework. My report contains columns of TextBoxes fields. Under certain conditions I need to hide the 2nd to last column. When I do this (set hidden property to True) the far right column for those rows with a hidden row slides over to the left rather than being aligned with others in that column. I am not using any properties that I can tell that would cause this. My current workaround is to make the text color for the column to hide White, but this is really a hack in my opinion and won't work if the back color is to change. Does anybody have any thoughts on how I can do this the right way, I.E. using a formula on the Hidden property of the TextBox rather than on the Color one?
Any help regarding this would be very appreciated!
You simply need to define an expression for the Value of the TextbBox that prints nothing when the condition is met.
=Iif(YourCondition = True, "", Fields!YourColumn.Value)

RDL report to show sort selection

Is there any way I can print the sorting option in a text box? For example, if my table has a "Status" column and I chose to sort by "Status", then I can print the word "Status" in a text box. This is the RDL report.
hopefully this is what you're trying to achieve?
Indicate parameter sort option with default values:
Then create a textbox and simply drag the parameter inside the textbox that should look like this:
Then when you try to preview the report and select a sort option, something like below should appear:
Hopefully this helps.
IF you are using a parameterized report where the sorting can change simply capture the the parameter in a text box or often what I do is create another dataset that is
Select #parameter1
Union select #parameter2
Union Select #parameterN
Then display that in another tablix (or cell depending on how many you have)

C# Replacement String

Hi To All Good Programmers,
I am developing a web-based app in which I need to generate some kind of reports. To do that, I prefer to use .rdlc embedded in VS 2010. There is a report named 'AccountReport' in which table rows are grouped according to some field of the table and it works fine.
The Problem: I need to add the Sum of a column as the last record of each group, the Sum is not a field of database table.. So How can I group it?
Here is a snap shot of what I need as the result. I have it already except the last record(row).
How Can I rich the 'Total' Record? It is grouped by the 'Current Asset'. This image is prepared using MS Word of course.
Any Idea pleas?
You need to use the Sum Function of Visual Studio Report Designer. Add a row in your report to show the total. Use the SUM function with your desired columnn name to set the expression. Check this answer for step by step pictorial details Sum of Column Values in rdlc report.
See similar question here

Crystal Reports Omitting Data

This might be a pretty simple question but I'm a Crystal Reports newbie...I have a report where I want specific pages that have a corresponding column omitted. So for example say it has someone's name and information on every page, how would I use a column that for example has the state on it, to omit certain results, like I don't want any pages in the report generated from states that have the "state column" from the database equal to like "TX" or something. This isn't what I'm actually doing, but it's an example of the functionality I want.
I'm thinking it would be in either the group or record selection formulas but I'm not sure how to go about putting it together to not create a page for the results when a certain column is equal to a value.
-Thanks from a total Crystal Reports noob.
So each page of the report is one record in the result set (someone's name and information) and you want to exclude some pages based on the value of one of the columns?
Perhaps I'm not understanding the problem correctly but can't you just change the datasource query?
WHERE state <> 'TX'

Categories

Resources