Изменить значение в поле номера Crystal Reports на основе значения в другом поле

3677
gbeers

Я хочу создать условную формулу, которая изменит столбец PP.POSPAY_SALARY_MIN в моем отчете на основе значения другого столбца. Итак, вот логика, которую я пытаюсь воспроизвести, пока что с ошибками. Минимальные значения зарплаты вводятся в виде строки чисел с внутренним форматом, без десятичных знаков.

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

Я хочу, чтобы PP.POSPAY_SALARY_MIN был умножен на .0001, если P.POS_HRLY_OR_SLRY = 'S', иначе умножьте PP.POSPAY_SALARY_MIN на 0,01.

Могу ли я это сделать, и если да, то чего мне не хватает при форматировании формулы?

1

1 ответ на вопрос

1
André Kleinschmidt

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.