CR can not display in C# when using .....

Printed From: Crystal Reports Book — Forum Name: Talk with the Author

HI
I made a report in crystal report 2008,its working fine into CR2008

i can use simple report and can display into C#.

but i am facing now problem when i change in code of report,
this is code of report  written  into select expert window

    {CompanyInfo.cmpName} = {?CompanyNameParmField} and
    {PurchaseOrder.poSupplierName} = {?SupplierName}  and
    {Users.userLoginStatus};

upto this code working fine in CR 2008 and also in C#
but when add if condition then facing problem in C# but not in CR 2008


if HasValue({?SupplierName}) then
(
booleanVar  flag:=
    {CompanyInfo.cmpName} = {?CompanyNameParmField} and
    {PurchaseOrder.poSupplierName} = {?SupplierName}  and
    {Users.userLoginStatus};
)
else
(
 booleanVar  flag:=  {CompanyInfo.cmpName} = {?CompanyNameParmField} and
                     {Users.userLoginStatus}

)

without using

booleanVar  flag:=
also have same problem.even if do not use it, only one exception msg change little bit


when i use if condition then its work fine into Crystal reports S/W but can not load into  C#.

i got following error when try to load this report into C# CR viewer.

"A number, currncy amount,boolean,date,time,date-time or string is expected here."
C:\filename.rpt
Error in formula <Record Selection>


A number, currncy amount,boolean,date,time,date-time or string is exprected here"







Put this into a formula instead of into the Select Expert.  Take out the booleanvar because you don't need it. For this example, I'll call this formula "SelectIt"
 
In the Select Expert, take out all of what you have and type in:
 
 
The problem with using a formula like this is that the filter will NOT be passed to the database.  Instead, Crystal will pull in all of the data and apply the filter in memory so it's going to slow down your report.
 
-Dell