Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Any one pls explain the logic after sum function
Num( If(vLanguage = 'EN', If(%Condition_WellCluster_EN = 'Injection_Volume', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Injection_Volume), If(%Condition_WellCluster_EN = 'Withdrawal_Volume', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Withdrawal_Volume), If(%Condition_WellCluster_EN = 'Water_Production', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Water_Production), If(%Condition_WellCluster_EN = 'Specific_Water_Production', Alt( Sum( {< Well.Name*=Well_Cluster_1::Well.Name, TW_SP_BO.Withdrawal_Volume={">10000"}, TW_SP_BO.Water_Production={"<200"} >} TW_SP_BO.Water_Production*1000) / Sum( {< Well.Name*=Well_Cluster_1::Well.Name, TW_SP_BO.Withdrawal_Volume={">10000"}, TW_SP_BO.Water_Production={"<200"} >} TW_SP_BO.Withdrawal_Volume/1000) , 0) )))), If(%Condition_WellCluster_DE = 'Injection_Volume', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Injection_Volume), If(%Condition_WellCluster_DE = 'Withdrawal_Volume', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Withdrawal_Volume), If(%Condition_WellCluster_DE = 'Water_Production', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Water_Production), If(%Condition_WellCluster_DE = 'Specific_Water_Production', Alt( Sum( {< Well.Name*=Well_Cluster_1::Well.Name, TW_SP_BO.Withdrawal_Volume={">10000"}, TW_SP_BO.Water_Production={"<200"} >} TW_SP_BO.Water_Production*1000) / Sum( {< Well.Name*=Well_Cluster_1::Well.Name, TW_SP_BO.Withdrawal_Volume={">10000"}, TW_SP_BO.Water_Production={"<200"} >} TW_SP_BO.Withdrawal_Volume/1000) , 0) )))) ) , '#.##0,'& Repeat('#', 2))
Break this horrible, complex expression into its component parts and see and understand how they work. then reassemble the parts step by step until you understand the complete expression.
Hi,
A little formatting will help us to understand better,
First check if Language is EN if yes execute first block else second block.
Within the first block there are four if statements first three are straight forward and the fourth one is in the below format
Alt(sum(expression) / sum(expression) ,0 )
Thanks
Raja.