Report parameters always using design time values - telerik

How do I get the report to use a design-time set value on first run, and then use whatever the user inputs for subsequent 'refreshes'?
I'm using .Net 4 and Telerik Q1 2013 Reporting controls.
I've created a report that has a StartDate and EndDate parameter, which is passed to a SQL query and returns relevant data.
To make it easier for the users to just open and run the report with minimal effort, the StartDate and EndDate have a default value, being set as the first and last day of the current month respectively.
This works great. However, if the user changes these values after the report is loaded, and tries to run the report for say the first to last day of the previous month, the query does not use the user-entered values. Instead it always uses the expression for what is supposed to be the default value.
The way I set the default value is by opening the ReportParameter Collection Editor (right-click in the report, click Report Parameters), and set the Value property of the parameters.
The StartDate is set to:
=StartOfCurrentMonth()
and EndDate is set to
=EndOfCurrentMonth()
Any help would be greatly appreciated!

Stephen,
What you've outlined here works for me, are you maybe not running the service pack? I set the Value property in the ReportParameter Collection editor to both StartDate and EndDate as:
='3/1/2013'
The preview of the Report runs immediately with the default values. I am able to change the values and preview the report fine.
I created a Windows Forms application that creates an instance of the report. When the report first renders, it renders with the default values and I am also able to change the values in the ReportViewer as an end user and re-render the report with no issues.
TopPageViews report = new TopPageViews();
InstanceReportSource reportSource = new InstanceReportSource();
reportSource.ReportDocument = report;
this.reportViewer1.ReportSource = reportSource;
this.reportViewer1.RefreshReport();

Related

Crystal Report not filtering SQL records based on selection formula

unfortunately I'm not an expert of Crystal Report, so I'll post here my question hoping for any help about my issue.
I want to display inside my report the result of a filter on a SQL RecordSet; this RecordSet is looked up from an a single table, of which I want to show some fields of my SQL table, while the filter I want to apply is based on a field parameter (defined static) that I'm trying to set programmatically.
Here below I attached my code where I'm applying the record selection formula, I tried also hard-coding the value instead of passing it through a dropdown selection:
ReportDocument RPT_Doc = new ReportDocument();
RPT_Doc.Load(RPT_Path_Name, OpenReportMethod.OpenReportByDefault);
ApplyConnInfos(ref RPT_Doc);
RPT_Doc.SetParameterValue("data_riferimento", "20161001");
RPT_Doc.RecordSelectionFormula = "{viaggi.data_part_pre} = '20161001'";
crystalReportViewer1.ReportSource = RPT_Doc;
In the first image attached you can find the field parameter definition, while second image is the record selection formula I defined inside my report:
The report always shows all the records of my table (more than ten thousand rows), instead of displaying a filtered RecordSet. The odd thing is Preview function from Visual Studio works like a charm; it prompts the field value, once I confirm the value the viewer displays the report with the rows filtered as I expect..
What am I missing from report/C# program configuration to make the record selection work?
Thank you in advance for any suggestion you can give me :)
Leonardo
Ok, finally we got the solution to our issue.
We found the CrystalReportViewer object used to display generated reports has 2 different properties, SelectionFormula and ViewTimeSelectionFormula; both has default value set to empty string.
Below I attached the picture of .Designer.cs file with the 2 properties valued:
We commented those 2 properties and the selection formulas and field parameters applied through code / report designer worked again.

TelerikReport send null as parameter to StoredProcedure

I want to use Telerik report in project, and want to use a stored-Procedure as data source. So, I should make a report in Telerik Report Designer in first step (my problem), and then use it in my Asp.net project.
I exactly used the (wizard) approach to make data source and parameters, mentioned in Telerik documentations, but there is a problem:
The report passes only the default parameter defined on design time, and when I change the parameter value in preview mode, it doesn't be passed to SP. If I set no default value for my parameters, the SP would be call by null values, always. It seems there is no mapping between input textboxes and the parameters are be sent to SP.
Is there anybody had the same experience, that can help me?
UPDATE:
What I did:
create new blank report in Telerik Report Designer R1 2017
From Data tab, Select SQL Data Source,select the proper SP from an Existing Data connection, leave the parameters default value empty and then execute...and finish.
In Report Explorer window, right click on Parameters, and add new parameter with the name and data type of stored procedure parameter. Change it's visibility to true, without any value.
From Home tab, select the preview and checked the SQL Profiler for db calls tracking. The Sp is called by null values at first time, but even when I change the parameter value in preview mode, again the SP is called by null parameter values.
In design time, after selecting your SP as data source, you will see the Configure Data Source Parameters.
In this window, you see your SP's parameters with value types. In Value column, click each row and select <New Report Parameter> and then select the parameter. The value will be change to proper value, for example:
= <Parameters.CustomerNumber.Value>
And this will work correctly. The problem was the 3th. step in question above. (adding the parameters, manually)

how to change default settings for the new user (Vtiger CRM)?

When creating new user in Vtiger CRM lot of predefined settings (time zone, currency, etc.) are wrong form specific company setup. But I was unable to find info how to change in settings, nor with script, without getting too deep into file structure.
Is it possible (and how)?
To change the default value during entity creation, you need to change the order of values by setting the first value you want.
In vTiger each picklist has the values store in a table for example vtiger_time_zone for time_zone.
If, for example, you want to set the time zone to "Europe/Amsterdam" you need to find the corresponding value of the key field time_zoneid through query
SELECT * FROM vtiger_time_zone where time_zone = "Europe/Amsterdam"
In my case the corresponding time_zoneid returned by the query is 44.
At this point, it is necessary to change the sort order of the new desidered default value by excuting the query
UPDATE `vtiger_time_zone` SET sortorderid` = '0' WHERE `vtiger_time_zone`.`time_zoneid` = 44;
Finally, it is necessary that to move to the second position the option with time_zone = "Pacific/Midway" (time_zoneid = 1) by executing query
UPDATE `vtiger_time_zone` SET sortorderid` = '1' WHERE `vtiger_time_zone`.`time_zoneid` = 1;
Thew default currency value, instead, is given by the default value stored in $currency_name in config.inc.php and setted during the installation.
Yes you can change the Time Zone, Currency details from CRM GUI only without going into code. Just follow this simple steps.
Login to CRM with any user. After login you will see User Name or Image (If profile picture set) on top right corner. There you will get a link for "My Preference". Click on that link which will allow to change User wise Setting. This setting will be User wise so it will not take effect for other Users.
Cheers!!!!

How can I get a date entered in a VB6 application to display on a Crystal report?

I have a VB6 application where a user inputs a date range and the dates are used to populate a Crystal 8.5 report using a selection formula within the VB6 code. I need to display the date the user selected on the report. Since the date is technically not a parameter, I am not sure what I can put within the field object/formula field to get the date from the application. Any and all help would be greatly appreciated!

How to get Custom BIRT reports in SilkCentral Test Manager to pull the currently selected project?

We are using Eclipse (Galileo) to create some custom BIRT reports (version 2.5) for SilkCentral Test Manager (version 11). When creating the report in SCTM, we have to specify the SQL query to be used for the report. We also have to specify the SQL query when designing the BIRT report in Eclipse.
I know that in the SCTM SQL statement we could specify parameters to be pulled based on the current settings, such as the currently selected project:
WHERE TPN.PROJECTID_FK = ${$PROJECTID}
I thought this would carry over to the BIRT report that is associated with the SCTM report, but this is not the case. I created a new report in SCTM and specified the following query (which contains no information that will be displayed in the BIRT report):
SELECT proj."ProjectName", proj."ProjectID_pk"
FROM "Silk"."SCC_Projects" AS proj
I then went to the report tab and associated a custom report and the report displayed correctly, proving that it is using the Data Source/Data Sets from BIRT and not the SQL provided in SCTM.
The problem I'm facing is that I want the custom report to display the currently selected project, but I'm not able to specify it properly in Eclipse. I need this because I want to only have one report template to be used for multiple projects, instead of having to upload a custom report for every single project.
A Hardcoded value for the project definitely does not work:
WHERE TPN.PROJECTID_FK = 34
I tried setting it as a parameter (Name=projectID, DataType=Integer, DisplayType=Text Box, DefaultValue = 34).
WHERE TPN.PROJECTID_FK = ?
When this runs, the report pulls the Default Value, and not the currently selected project.
I tried setting it as a Dynamic Parameter (Name=projectID, DataType=Integer, DisplayType=ListBox, DataSet=ProjectID, SelectValueColumn=ProjectID_pk, SelectDisplayText=ProjectName, DefaultValue=36)
This also pulls the Default Value when the report runs.
Default value is a required field, so I don't know what to do to get this to work properly.
Any suggestions/solutions?
Here is the solution that I came up with using and example from BirtReports.doc from the Borland site:
In SCTM, I edited the SQL query from
WHERE TPN.PROJECTID_FK = ${$PROJECTID}
to
WHERE TPN.PROJECTID_FK = ${currentProject|34|ProjectId}
This creates a parameter named currentProject which passes the value 34 to the BIRT report under the parameter name rp_currentProject.
I then edited the BIRT report's projectID parameter to have the following values: Name=rp_currentProject, DataType=Integer, DisplayType=TextBox, DefaultValue = Empty/Null.
In the DataSet for the report, I edited the ? parameter to be:
Name=param_1, DataType=Integer, Direction=Input, DefaultValue=GreyedOut/Disabled, LinkedToReportParameter=rp_currentProject.
So, I upload the same report template to multiple projects and under the Report > Parameters Tab in SCTM I change the value of the currentProject parameter to the correct project ID. This ID is passed to the Report and the correct information is displayed.
BTW, I also tried this format but I was getting conflicting type errors:
WHERE TPN.PROJECTID_FK = ${currentProject|${$PROJECTID}|ProjectId}
I also tried using DECLARE/SET in the SQL to set the passed value to a variable, but I was getting an error stating that the SQL statement is invalid because it is no longer read-only.
Hope this helps anyone that has this same problem!

Resources