unbounded field in crystal report by pass parameter at runtime - c#

I have a report in crystal report.
In that report, I need to set the field to 'Go' if the value is 0, and set the field to 'NoGo' if the value is 1.
I have created an unbound field string and write formula as below:
if {?idline}=1 and tonumber({bevarage;1.torque})=0 then {#UnboundString2}='Go'
else if {?idline}=1 and tonumber({bevarage;1.torque})=1 then {#UnboundString2}='NoGo'
but this is not working and always returns an empty string from unbounded field.
Please help me to fix it.

Assignment operator in Crystal is := rather than =
Why not simply create a formula that depends on the parameter?

Related

Pass a null date to a crystal report parameter using SetParameterValue

I have a situation where I have a crystal report where I pass in a start and end date via rdoc.SetParameterValue this works fine, except that, I do not want it to show a date if I pass nothing for the date variable, I just want it to be blank
To an attempt to do so i have written
if (DateStart != defaultDate)
{
rdoc.SetParameterValue("DStart", DateStart);
}else
{
rdoc.SetParameterValue("DStart", "");
}
Which gives me the error The types of the parameter field and parameter field current values are not compatible of course, this makes sense because I am trying to set a date to a string variable.
However, I am unable to think of a solution, nor do I see any solution in the Parameter's menu.
Appreciate it if I be given some assistance to solve this.
Regards
You may change the parameter type to string and pass the date as string:
DateStart.ToString()
I don't like this solution, but it works. Usually i just require the date.

A Boolean is required here in Crystal Report

I want to show "NoData" if its value is less than Zero and "Commission" if its value is greater than Zero. When i show "String" its gave me error the boolean is required here and then if i do toText{VBookingCommission.MarketingPersonnelCommission1} it gaves me Error Convert it to String
This is my Query for Crystal Report
if({VBookingCommission.MarketingPersonnelCommission1}<0)
then "NOData" else "Commission";
If i do this its working Fine
if({VBookingCommission.MarketingPersonnelCommission1}<0)
then true else false;
The issue was that i was putting in under Suppress i need to put it in Formulas and i start working just fine!!!
I wrote a code like what you need. in formula edit form set visual basic instead of crystal report.
code:
if({VBookingCommission.MarketingPersonnelCommission1}<0) then formula="NOData" else if({VBookingCommission.MarketingPersonnelCommission1}>0) then formula="Commission"
This is happing because the variable type is Boolean. Either you need to use true or false.
OR
change the type of data of the variable and update the Data source using 'Verify Databases' or 'Set Datasource Location'

How to "force" an Crystal Reports optional parameter to not need a value

I have a crystal report that has an optional parameter called Supplier Name.
My Selection Expert logic is set up like this:
**if hasvalue({?Supplier Name}) then
{q_InStockItems_ByUnitSize_vw.primary_supplier_id} = {?Supplier Name}
else
true
So if no value is entered in the optional parameter, all the records are returned.
I am populating the parameter via C# using the following line of code:
InventoryReport.SetParameterValue("Supplier Name", SupplierID);
The problem I am experiencing is that I want to have the ability to not programmatically pass a value to the optional parameter, so all the records are returned.
If I don't specifically provide a value to the optional parameter, Crystal Reports opens the report, and displays the parameter entry window.
I can hit ok and all the records get displayed, but I'm hoping there is some way to skip over the above step.
Try this
if IsNull({?Supplier Name}) then true;
else {q_InStockItems_ByUnitSize_vw.primary_supplier_id} = {?Supplier Name};

Obtaining calculated field valid value from ssrs report

I have a report in which I have a parameter that has the following Valid Values: value set to a query field and label set to the following calculated field ::
=Fields!RestaurantCode.Value & " - " & Fields!Name.Value
I then obtain in c# the valid values from the report (after it's been deployed), if I set the value and label to query fields everything works fine. However with a calculated field, ReportingService2010 .GetItemParameters returns null for the ValidValues.
I've tested the report and correctly see the calculated field displayed in the report. I've tried referencing only a field in the calculated field expression (=Fields!RestaurantCode.Value) and ValidValues is still null.
How can I correctly obtain a calculated field through .GetItemParameters ValidValues?
EDIT: forRendering parameter of the .GetItemParameters function is set to true
I don't think this is a valid scenario for SSRS - mixing Query values and static Labels for a single Parameter. I would move that calculation to the query as a new field.

Display Parameter value on SSRS Report

I am very new to SSRS.
I have added one Parameter named Date on SQL Server Report
i have set parameter value from aspx.cs code behind file
i have drown that parameter on ReportHeader and i want display CurrentDate value on that parameter
and i tried =Join(Parameters!Date.Value,", ") but it displays #Error at runtime.
i also tried =Join(Parameters!Date.Label,", ") but it displays Nothing.
Please tell me how to display Parameter value on Report?
Not sure I understand what you are asking. To display the parameter value on the report, create a textbox on the report and then set it's expression to your parametername.value.
Something like this:
=Parameters!Date.Value(0)
Not sure what ur asking ...wheather u need report run date or parameter passing date ....
If u need report date .... follow this
Drag a textbox onto the report ...page header or footer
and ----> =Today()
If u need parameter value(date) what ur passing
Just the parameters!paraame.value ...
If I'm understanding your correctly you want to do:
=Parameters!Date.Value & ", "
& is the string concatentation operator in SSRS, you must have a space on each side of it FYI

Categories

Resources