Modify value in a Crystal Reports number field based on value in another field

1

1

I want to create a conditional formula that will change the PP.POSPAY_SALARY_MIN column in my report, based on the value of another column. So here is the logic I am trying to duplicate, so far with errors. The Salary min values are coming in as an internally formatted string of numbers, no decimal points.

   select <these are among the many columns in my report>
      ....
      P.POS_HRLY_OR_SLRY,
      PP.POSPAY_SALARY_MIN, 
      ....

I want PP.POSPAY_SALARY_MIN to be multiplied by .0001 if P.POS_HRLY_OR_SLRY = 'S' else multiply PP.POSPAY_SALARY_MIN by .01.

Can I do this, and if so, what am I missing in the way I am formatting the formula?

gbeers

Posted 2015-05-21T18:37:00.823

Reputation: 11

Answers

1

general suggestion

It's often easier to write condintional calculations as calculated fields instead of writing them inside your SQL statements.


step by step guide:

  1. Make the field explorer visible, by either using the icon in the tool bar or the menu "View -> Field Explorer"

show field explorer

  1. Look up the entry for formula fields with the fx symbol and right-click to open the context menu. Choose "New..."

open context menu and choose new...

  1. The formula editor will open and you can use the crystal report programming language to create your conditional value

formula editor

  1. You can drag and drop the formula field from the field explorer in the same way to your report as you can do it with the database fields.

I apologize for the German screen shots. I have no English Crystal Report installation available. Maybe some captions will vary from my translations of the terms.

André Kleinschmidt

Posted 2015-05-21T18:37:00.823

Reputation: 109