Friday 21 April 2017

Record Selection Formula Error

Today I will discuss  very Important Topic related to Your Record selection Formula or Group Selection formula.Today I faced different type of Problem in my record selection from which every time I tried report not open and errors occurs. I checked  my Record Selection formula but I did’t find.I wrote the Formula like this :

//{vDynaCube_EnquiryBkgSalesRpt.userId} = {?Staff_Id} and
//{vDynaCube_EnquiryBkgSalesRpt.EnquiryDate} in {?FrmEnquiryDate} to {?ToEnquirydate}

IF {?Report For}='ENQUIRY' THEN
({vDynaCube_EnquiryBkgSalesRpt.EnquiryDate} in ({?FrmEnquiryDate} to {?ToEnquirydate})) and
(if {?Staff_Id}=0 then ({vDynaCube_EnquiryBkgSalesRpt.EnquiryDate} in ({?FrmEnquiryDate} to {?ToEnquirydate})) else {vDynaCube_EnquiryBkgSalesRpt.userId}={?Staff_Id} )
ELSE IF {?Report For}='JOURNEY' THEN
({vDynaCube_EnquiryBkgSalesRpt.JourneyDate} in ({?FrmEnquiryDate} to {?ToEnquirydate}))and
(if {?Staff_Id}=0 then ({vDynaCube_EnquiryBkgSalesRpt.JourneyDate} in ({?FrmEnquiryDate} to {?ToEnquirydate})) else {vDynaCube_EnquiryBkgSalesRpt.userId}={?Staff_Id} )

In this Formula there is a Parameter Which name is Report for .And In this formula I fixed two Constant Value which was ‘Enquiry’ & ‘Journey’.It means if user will select the Enquiry  then data will come according to between   enquiry date and Staff_id.
Similarly for the else Case. All is ok But Error msg was Coming  which was :

//{vDynaCube_EnquiryBkgSalesRpt.userId} = {?Staff_Id} and   fields not found.

I Confused that where I m wrong. After that I Deleted the Commented Statement which was :
//{vDynaCube_EnquiryBkgSalesRpt.userId} = {?Staff_Id} and
//{vDynaCube_EnquiryBkgSalesRpt.EnquiryDate} in {?FrmEnquiryDate} to {?ToEnquirydate}
First two lines of the Record selection but it was commented then I again run my report now it run properly without any error.
Then I got that “Every Line whether it is Commented Or Not gives their Effect On the Record Selection Formula.”

Tips Of the Days : Not Leave any Commented Statement On Your Record Selection formula.

No comments:

Post a Comment

Control Structures (Crystal Syntax) In Crystal Report : If Expressions (Crystal Syntax) in Crystal Report

Formulas without control structures execute each expression in the formula exactly once when the formula is evaluated. The expressions are...