Use of nested Function and DECODE Function

In the saved search we need to show the updated rate on the project task. At present, the rate field shows the current rate and we will be reducing the rates by 3%. Before the new rate is updated in the project task we can see the new rate for each project task using the nested or DECODE function.

Saves Search

We have created a project task saved search and the Criteria tab includes

Project: Internal ID

Formula (Numeric): CASE WHEN {projecttaskassignment.unitprice} IN (’75’,’77.50′,’80’,’150′,’155′,’160′) THEN {projecttaskassignment.internalid} ELSE NULL END

In the Formula field, we specifically mentioned the current rate using the CASE WHEN function. Here we can see we need to update more than one rate.

Project Subsidiary

Under the result tab, we have added the following details for showing the new rate on the project task.

Using the below formula on the saved search we can see the new rate with the corresponding current rate.

( Note: If the current rate contains any decimal place use () instead of ”)


DECODE({projecttaskassignment.unitprice},’75’,’72.750′, ’80’,’77.50′,(77.50),’75.00′,’150′,’145.50′,’155′,’150.00′,’160′,’155.20′)
or

CASE WHEN {projecttaskassignment.unitprice}= 75 THEN 72.75 WHEN {projecttaskassignment.unitprice}= 77.50 THEN 75.00 WHEN {projecttaskassignment.unitprice}= 80.00 THEN 77.50 WHEN {projecttaskassignment.unitprice}= 150 THEN 145.50 WHEN {projecttaskassignment.unitprice}= 155 THEN 150 WHEN {projecttaskassignment.unitprice}= 160 THEN 155.20ELSE NULL END

In the above-saved search, we can see the unit rate shoes the current rate, and the two new rate field shows the corresponding new rate by reducing 3%(as per our requirement).

(Note: New rate (case ) shows the result of using the CASE WHEN formula and New rate shows the result using the DECODE function)

Leave a comment

Your email address will not be published. Required fields are marked *