cancel
Showing results for 
Search instead for 
Did you mean: 

Formula workshop issue

Former Member
0 Kudos

Hi all,

I try to create a formula name COMMN to calculate the commission sale based on each car sells as following:

-----------------------------------------------------------------------------------------------------------------------------------------------------------

IF ISNULL({CarModel})

THEN

(

   IF {CarMake} = 'BMW' And {Condition} = 'Excellent'

      THEN(ToNumber({GrossSale}) - ToNumber({ServiceFee})) * 0.50

   ELSE IF {ReportGSRCSpecialSurplusDataT{CarMake} = 'BMW' And {Condition} = 'Good'

      THEN (ToNumber({GrossSale}) - ToNumber({ServiceFee})) * 0.30

   ELSE 0.00

)

ELSE  //car models such 740, 535, 315, Z3, Z4,  etc...

   IF MID({CarModel, 1, 1) = '7'

      THEN (ToNumber({GrossSale}) - ToNumber({ServiceFee})) * 0.25

   ELSE IF MID({CarModel, 1, 1) = '5' OR MID({CarModel, 1, 1) = '3'

      THEN (ToNumber({GrossSale}) - ToNumber({ServiceFee})) * 0.15

   ELSE IF MID({CarModel, 1, 1) = 'Z'

      THEN (ToNumber({GrossSale}) - ToNumber({ServiceFee})) * 0.10

----------------------------------------------------------------------------------------------------------------------------------------------------------------

and put A in the detail section. When I run the report I can see other column data but nothing in COMMN. Is it something wrong in above codes even no syntax error when create it. Any help is much appreciated. Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

I would try changing the first line to something like this:

IF ISNULL({CarModel}) or {CarModel} <= 0

Also, instead of using "Mid" to get the first letter of the model, try using Left({CarModel}, 1).

-Dell

Former Member
0 Kudos

Hi,

I changed to {CarModel} <= 0 and display an error in formula. Any further help?

DellSC
Active Contributor
0 Kudos

Sorry, try {CarModel} <> "" - for some reason I assumed it was a number, not a string.

-Dell

Former Member
0 Kudos

Hi,

I found the reason why the formula results is displayed nothing because I used the wrong datatable in dataset for data source. There were not wrong in Crystal Report condition syntax. Thanks anyway.

Answers (0)