Question

Sum of 2 values ​​that I created in a logical unit by referring to another field of this same logical unit

  • 13 October 2021
  • 5 replies
  • 105 views

Badge +2

I would like to retrieve the sum of 2 values ​​that I created in a logical unit by referring to another field of this same logical unit. I cannot configure the 2 fields: Argument and Select

select nvl(Cf$_Pv_Contrib,Cf$_Pr_Contrib,0)  from avenant_projet_clv  where Cf$_project_id= : project_id

 


This topic has been closed for comments

5 replies

Userlevel 5
Badge +13

HI @mathieut43,

As you want to take the sum of the two values, the sum function should be used.

Example:

select SUM( NVL(FIELD1,0)+NVL(FIELD2,0))
from avenant_projet_clv  
where Cf$_project_id= : project_id

Note: Instead of FIELD1 and FILED2 specify the filed names you want to consider for the summation.

Do you want to take the summation of the field Cf$_Pv_Contrib twice?

Hope this helps!

Best Regards,
Bhagya

 

Badge +2

Hello @Bhagya Wickramasinghe,

When I validate the creation, I have the following message, I have the impression that the problem comes from the syntax of the project_id field of the logical unit that I created.

 

Userlevel 5
Badge +13

Hi @mathieut43,

instead of avenant_projet_clv can you use avenant_projet_clt?

Arguments: t.project_id

The select statement should be,

select SUM( NVL(FIELD1,0)+NVL(FIELD2,0))
from avenant_projet_clt  
where Cf$_project_id= : project_id

Best Regards,
Bhagya

Badge +2

It doesn't work if i use your method. I don't know if I am using the correct method. My need: I would like to enter 2 amounts in the logical unit that I created. When I validate the form I would like the amount_margin field to be calculated with the sum of the 2 fields entered.

 

 

Userlevel 3
Badge +5

Hi @mathieut43 ,

Kindly check whether any read-only attributes have been involved in this process. This kind of error might occur during validation of read-only custom fields.

Best Regards,

Anjaleen