I have a section in a Crystal Report that I want to suppress. I need to suppress it if there are 0 rows in a particular table in the dataset I am using. How would I do this? The Record Number special field provided appears to be an internal count of records in the report, and does not relate to the rows in the underlying data table.
I am creating the report from C#, but I cannot suppress the section from the code (it doesn't fit the project structure) - I must be able to do it from the report itself. The table concerned is definitely being passed to the report in the dataset, but it contains 0 rows. There must be a way to establish this inside the report itself.....
Can anyone please point me in the right direction?
In the Crystal Reports designer, view the properties of your section and there should be an option to Suppress, which you can give it a formula to return the appropriate boolean value.
You could then use the Count() function within that formula and (I believe) you can pass the name of your dataset to the Count() function to get the number of rows in that dataset.
I did the same thing on a complex report about 3 months ago but I don't have access to the report any more having changed jobs so I'm sorry I cannot be more specific, but hoepfully this gives you a starting point.
Just had a quick Google - try this.
If the section does only contain database fields and f.e. no text fields, then you could use the setting "Suppress Blank Section" in the "Section Export" (rightclick section) for that section.
As an alternative you could use the following formula in the "Suppress" in the "Section Export" for that section:
IsNull({table.field})
"{table.field}" is one of the fields in the dataset.
Hope this helps.
Go to "Section Expert" and click "Supress (No Drill-Down)" and try adding this:
IF {"DragYourFieldHere"} = "" then true else false
Create one dummy group,check on its header for each page,add the header in the group header of the dummy group.
Related
I have a plug-in. This plug-in should get the values seperated by commas from multitext field one by one and stores to an optionset field.
And also this plugin should get values(ids) from multitext field seperated by comma and searches the ids one by one in lookup field values. If found (the search operation should be done one by one in a loop;since there will be more thean one id to search), the value should be seen in the lookup field.
After theese opertaions the plugin should save the entity.
How can i do this in crm 2015 using c# visual studio plug-in? Can anyone help me please
So, in a nutshell, what do you want to do is to generate the CRM metadata dynamically from a comma separated input, like a CSV?
Have a look at the CreateOptionSetRequest and InsertOptionSetValueRequest in CRM, this will allow you to insert new option set values for a given option set.
Those will allow you to dynamically create an option set field, and populate option set values for that field, respectively.
For lookups, If I understood correctly, you can link records to each other using AssociateRequest messages.
Hope this helps
I am designing a report With the Format With Multiple Columns option in the crystal report to display 10 records per column.But, my result set is Showing like,
1.Row1
2.Row2
3.Row3
4.Row4
5.Row5
6.Row6
7.Row7
8.Row8
9.Row9
10.Row10
11.Row11
12.Row12
13.Row13
14.Row14
15.Row15
16.Row16
17.Row17
18.Row18
19.Row19
20.Row20
instead of
1.Row1 11.Row11
2.Row2 12.Row12
3.Row3 13.Row13
4.Row4 14.Row14
5.Row5 15.Row15
6.Row6 16.Row16
7.Row7 17.Row17
8.Row8 18.Row18
9.Row9 19.Row19
10.Row10 20.Row20
what else I had to do to split the rows and display.
Note: I had already asked this kind of Question and got the answer to use Format With Multiple Column in this Link.
to set multiple columns you have first to do to Report -> Section Expert
Then in the details section you have to check Format with multiple columns
After that you should select the layout tab and set width of your column and the gab between them.
In my Crystal Report, I want to show the Field values in Upper Case.Is there any way to do this?
You don't need to create a separate Formula Field to achieve this result.
Instead, add the following to the field's Display String conditional formula:
UpperCase(CurrentFieldValue)
Here you go ... http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=8823
You will notice in this example they are using the UpperCase function of Crystal Reports. So, all you need to do is say UpperCase(some field name) and that take care of it for you.
I am not creating RDL from scratch so maybe this is a problem -- I work on already prepared files.
MSDN states that CommandText in RDL file can contain T-SQL query. Ok, this I understand, but what else it can contains?
I am asking because the phrasing clearly indicates you can put some other expression there
So if I understand correctly, I can look at RDL code (in Visual Studio, RMB on RDL file, "view code") and the interesting parts would be...?
DataSourceName -- this is a "link" to database via definitions of data sources
CommandText -- I thought this is the place to put query, like SELECT... but from what I see there are no queries used
Reporting service, loads the rdl file into it, and starts parsing and reading the command according to their sections like
data source, report params, etc.
gets the values of params (if any). start using the data source database connection. execute the query/ sp command. get the data, and store in seperate data fields which are also mentioned in rdl. binds their values with controls (text box, grid columns etc), if there is any expression written into it, execute them as well.
Generate the output (html/ pdf).
And there you Go.
I just tried to explain in short and simple words. you can check out msdn for complete detail.
Regards,
Mazhar Karimi
You can create reports manually and fill them with any data that you would like to.
Sth like:
ReportDataSource reportDataSource = new ReportDataSource();
reportViewer.Reset();
reportDataSource.Name = "DataSetOdczyty_klienci_adresy";
reportDataSource.Value = klienciadresyBindingSource;
reportViewer.LocalReport.DataSources.Add(reportDataSource);
reportViewer.LocalReport.ReportEmbeddedResource = "Wodociagi.Reports.ReportListaKlientow.rdlc";
You can open the report file *.rdl with an XML editor like Notepad++. Then, search for <DataSets> and you will find the datasets used in the report.
The field names of each data set are in the <Fields> section
In the <Query> section of each data set you can find <CommandText> and <QueryParameters> as shown in the example below
Example:
<Query>
<DataSourceName>MyDataSource</DataSourceName>
<CommandType>StoredProcedure</CommandType>
<CommandText>usp_QueryCustomers</CommandText>
<QueryParameters>
<QueryParameter Name="#CustomerId">
<Value>=Parameters!PersSysId.Value</Value>
</QueryParameter>
<QueryParameter Name="#RowsCnt">
<Value>=Parameters!RowsCnt.Value</Value>
</QueryParameter>
</QueryParameters>
</Query>
I didn't find a way to see that in Visual Studio's report editor easily. Maybe the bounty I have started helps here (does someone like to earn the 50 reputation points)?
Initially, I was not sure why both the OP and #Matt are reading the XML directly instead of editing the query in Visual Studio (I only resort to that in extreme cases). But now I think you might have failed victims of the missing "Report Data" pane.
Open the report in Visual Studio BIDS like normally, then from View menu select "Report Data". If it's not there, click on the report canvas anywhere, then it should appear. In the "Report Data" pane that will appear, you're interested in Data Sources (where's the data coming from?) and Datasets (what are the queries, parameters, expressions?).
I have added a parameter to my report with the option "Allow Multiple Values" checked.
This is a status column (IE, Proposed, In Progress, Completed, Canceled), and I want the user to be able to select which (and how many) different OrderStatus to report on.
How I normally set parameters is:
report.SetParameterValue("#dtBegin", dtBegin.DateTime);
What I tried to do for the multiple values was something like this:
//pseudo loop
foreach(int intOrderStatus in intSelectedOrderStatuses)
{
report.Parameter_OrderStatus.CurrentValues.AddValue(intOrderStatus);
}
I have checked it does add the values to the OrderStatus parameter, but when the report runs, the CrystalReports dialog pops up and asks me to enter values for the OrderStatus parameter. So it seems as though the values aren't "commited" to the parameter. I have done a number of searches and can't figure out why it's not working.
Thanks,
Just set the parameter value with an array of ints.
report.SetParameterValue("#OrderStatus", new int[]{1,2,3});
in the select expert you would use the in operator.
{table.order_status_id} in {?#OrderStatus}
What you can do is, make a normal parameter field,i.e without multiple values, only discreet values true, all you need to pass is 1,2,3,4. "," is the delimiter for separation use what ever you think works for you, then in record selection formula simply put
{table.order_status_id} in split({#OrderStatus}, ",")
all you need to pass from you page is the string 1,2,3,4 and it should work
Have you set the parameter to Hidden in the Crystal Reports parameter options?
I haven't tried this, but I think that you should be able to add intOrderStatus to either a ParameterDiscreteValue or ParameterRangeValue and pass that into Parameter_OrderStatus.CurrentValues instead of intOrderStatus.
Well i have same issue. The work around is very simple. Don't add data source after parameters. e.g
report.SetParameterValue("#dtBegin", dtBegin.DateTime);
report.SetParameterValue("#dtBegin2", dtBegin.DateTime1);
//Note datasource is assigned after parameters
report.SetDatasource(dataset);
The crystal report will refresh parameters before applying data source to report.
The below is the not popup discrete dialog box
//Note Datasource is applied before parameters
report.SetDatasource(dataset);
report.SetParameterValue("#dtBegin", dtBegin.DateTime);
report.SetParameterValue("#dtBegin2", dtBegin.DateTime1);
Following is tested in Crystal Reports version 13.0.20:
1) In Parameter Fields section add new parameter as follow:
Name: ParamMultipleOrderStatus
Type: Number
Value Options:
Allow multiple values: true
2) Choose the Select Expert Record ... in Crystal Reports and code may like this (use = operator):
{Orders.OrderStatus} = {?ParamMultipleOrderStatus}
3) Use following code:
foreach (int intOrderStatus in intSelectedOrderStatuses)
{
report.ParameterFields["ParamMultipleOrderStatus"].CurrentValues.AddValue(intOrderStatus);
}