Crystal Reports Multiple if conditions in Record Selection

21,523

The proper, record-selection-formula syntax for your needs:

(
if {?type} <> "All" then
  {cars_call_log.type} = {?type}
else
  true
)
AND
(
if {?status} <> "All" then
  {cars_call_log.status} = {?status}
else
  true
)
Share:
21,523
Sameera Silva
Author by

Sameera Silva

Updated on July 10, 2022

Comments

  • Sameera Silva
    Sameera Silva almost 2 years

    I want to create a report and filter it by two parameters as below;

    Parameter values are;

    Call_type = "All" , "Sale" , "Buy"
    and
    Call_status = "All" , "Sold" , "Pending" , "None" , "Closed"
    

    I have used below formula;

    (
    if {?type} <> "All" then
        {cars_call_log.type} = {?type}
    else
        true;
    );
    (
    if {?status} <> "All" then
        {cars_call_log.status} = {?status}
    else
        true;
    );
    

    But it will work only for first If condition. It doesn't work for both conditions.

    I want to make it like, Filter by first parameter then (filtered records)--> filter by second parameter.

  • Charles
    Charles about 10 years
    Code dumps are not answers. Please update your answer to include a description of what this code is, what differs from the original source, and what the changes do that fix the problem.