+ Start a Discussion
magandrezmagandrez 

Unable to show custom calculated value

Hi,

 

This is a very simple task. For some reason I cannot show on a VF page the value that I calculated in the controller side. Morever, it doesn't show anything on the debug, seems it doesn't get in the calculation. Here is the code:

 

Declaring the variables involved:

 

public List<Selected_Product__c> total{get;set;}
public decimal totalNet {get;set;}

 Getting all the rows related:

 

public generateServiceOrder(ApexPages.StandardController controller) {
 String servOrder= ApexPages.currentPage().getParameters().get('id');

 total = [SELECT Total_Gross__c
          FROM Selected_Product__c
          WHERE Service_Reservation__c =:servOrder];                                      
        
}

 Preparing the result to be retrieved by the VF:

 

public decimal getTotalNet(){
    
        totalNet = 0.0;
        for(Selected_Product__c allSelected:total){
        
            totalNet+=allSelected.Total_Gross__c;
        
        }
        return totalNet;
}

 

The VF:

 

<apex:outputText value="EUR {!totalNet}"/>

 

And this is the resulting debug. As you can see, it never gets into getTotalNet, and totalNet never gets populated.

 

24.0 APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
14:10:02.115 (115261000)|EXECUTION_STARTED
14:10:02.115 (115297000)|CODE_UNIT_STARTED|[EXTERNAL]|066R00000009cJp|VF: /apex/getServiceOrder
14:10:02.121 (121397000)|CODE_UNIT_STARTED|[EXTERNAL]|01pR0000000ER63|generateServiceOrder 
14:10:02.121 (121429000)|SYSTEM_MODE_ENTER|true
14:10:02.122 (122456000)|METHOD_ENTRY|[1]|01pR0000000ER63|generateServiceOrder.generateServiceOrder()
14:10:02.122 (122465000)|STATEMENT_EXECUTE|[1]
14:10:02.122 (122556000)|SYSTEM_MODE_ENTER|false
14:10:02.122 (122575000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:5
14:10:02.122 (122584000)|STATEMENT_EXECUTE|[1]
14:10:02.122 (122596000)|SYSTEM_MODE_EXIT|false
14:10:02.122 (122603000)|METHOD_EXIT|[1]|generateServiceOrder
14:10:02.122 (122746000)|VARIABLE_SCOPE_BEGIN|[8]|this|generateServiceOrder|true|false
14:10:02.122 (122777000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:20
14:10:02.122 (122791000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:20
14:10:02.122 (122797000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:20
14:10:02.122 (122808000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:20
14:10:02.122 (122827000)|VARIABLE_ASSIGNMENT|[8]|this|{}|0x30964412
14:10:02.122 (122841000)|VARIABLE_SCOPE_BEGIN|[8]|controller|ApexPages.StandardController|true|false
14:10:02.122 (122995000)|VARIABLE_ASSIGNMENT|[8]|controller|"StandardController [null]"|0x594f12a9
14:10:02.123 (123008000)|STATEMENT_EXECUTE|[1]
14:10:02.123 (123014000)|SYSTEM_MODE_ENTER|false
14:10:02.123 (123019000)|HEAP_ALLOCATE|[3]|Bytes:5
14:10:02.123 (123027000)|STATEMENT_EXECUTE|[3]
14:10:02.123 (123038000)|STATEMENT_EXECUTE|[4]
14:10:02.123 (123043000)|STATEMENT_EXECUTE|[5]
14:10:02.123 (123048000)|STATEMENT_EXECUTE|[6]
14:10:02.123 (123054000)|SYSTEM_MODE_EXIT|false
14:10:02.123 (123062000)|SYSTEM_MODE_ENTER|false
14:10:02.123 (123067000)|HEAP_ALLOCATE|[6]|Bytes:5
14:10:02.123 (123071000)|STATEMENT_EXECUTE|[8]
14:10:02.123 (123074000)|STATEMENT_EXECUTE|[9]
14:10:02.123 (123096000)|SYSTEM_METHOD_ENTRY|[9]|ApexPages.currentPage()
14:10:02.123 (123158000)|HEAP_ALLOCATE|[9]|Bytes:69
14:10:02.123 (123166000)|SYSTEM_METHOD_EXIT|[9]|ApexPages.currentPage()
14:10:02.123 (123186000)|SYSTEM_METHOD_ENTRY|[9]|System.PageReference.getParameters()
14:10:02.123 (123201000)|HEAP_ALLOCATE|[9]|Bytes:44
14:10:02.123 (123237000)|SYSTEM_METHOD_EXIT|[9]|System.PageReference.getParameters()
14:10:02.123 (123245000)|HEAP_ALLOCATE|[9]|Bytes:2
14:10:02.123 (123266000)|SYSTEM_METHOD_ENTRY|[9]|MAP.get(ANY)
14:10:02.123 (123283000)|HEAP_ALLOCATE|[9]|Bytes:15
14:10:02.123 (123289000)|SYSTEM_METHOD_EXIT|[9]|MAP.get(ANY)
14:10:02.123 (123298000)|VARIABLE_SCOPE_BEGIN|[9]|servOrder|String|false|false
14:10:02.123 (123309000)|VARIABLE_ASSIGNMENT|[9]|servOrder|"a0HR0000006AIgJ"
14:10:02.123 (123313000)|STATEMENT_EXECUTE|[11]
14:10:02.123 (123320000)|HEAP_ALLOCATE|[11]|Bytes:233
14:10:02.123 (123337000)|HEAP_ALLOCATE|[11]|Bytes:7
14:10:02.123 (123362000)|HEAP_ALLOCATE|[11]|Bytes:-4
14:10:02.123 (123369000)|HEAP_ALLOCATE|[11]|Bytes:7
14:10:02.123 (123374000)|HEAP_ALLOCATE|[11]|Bytes:15
14:10:02.123 (123388000)|HEAP_ALLOCATE|[11]|Bytes:-4
14:10:02.123 (123897000)|SOQL_EXECUTE_BEGIN|[11]|Aggregations:0|select Product__r.Name, Product_Content__c, Service_Time__c, Quantity__c, Unit_Price__c, Total_Net__c from Selected_Product__c where (Service_Reservation__c = :tmpVar1 and Billing_Category__c = :tmpVar2) order by Service_Time__c desc
14:10:02.144 (144334000)|SOQL_EXECUTE_END|[11]|Rows:2
14:10:02.144 (144365000)|HEAP_ALLOCATE|[11]|Bytes:12
14:10:02.144 (144390000)|HEAP_ALLOCATE|[11]|Bytes:776
14:10:02.144 (144435000)|HEAP_ALLOCATE|[11]|Bytes:784
14:10:02.144 (144471000)|METHOD_ENTRY|[11]|01pR0000000ER63|generateServiceOrder.__sfdc_servingorder(LIST)
14:10:02.144 (144511000)|HEAP_ALLOCATE|[3]|Bytes:20
14:10:02.144 (144533000)|HEAP_ALLOCATE|[3]|Bytes:20
14:10:02.144 (144546000)|HEAP_ALLOCATE|[3]|Bytes:20
14:10:02.144 (144561000)|HEAP_ALLOCATE|[3]|Bytes:20
14:10:02.144 (144577000)|VARIABLE_ASSIGNMENT|[-1]|this|{}|0x30964412
14:10:02.144 (144658000)|VARIABLE_ASSIGNMENT|[-1]|value|[{"Quantity__c":15,"Product__r":{"Name":"Pieneen nälkään 3","CurrencyIsoCode":"EUR","Id":"a0LR0000002CQ7IMAW"},"CurrencyIsoCode":"EUR","Service_Time__c":"9:45","Product_Content__c":"Janssoninkiusausta\nV (92 more) ...","Product__c":"a0LR0000002CQ7IMAW","Unit_Price__c":3.00,"Id":"a0MR0000002MxGZMA0","Total_Net__c":45.00},{"Quantity__c":12,"Product__r":{"Name":"½ Pv.Kokouspkt I","CurrencyIsoCode":"EUR","Id":"a0LR0000002CQ7YMAW"},"CurrencyIsoCode":"EUR","Service_Time__c":"9:15","Product__c":"a0LR0000002CQ7YMAW","Unit_Price__c":3.00,"Id":"a0MR0000002IdVsMAK","Total_Net__c":36.00}]|0x52bfeda2
14:10:02.144 (144734000)|VARIABLE_ASSIGNMENT|[3]|this.servingorder|[{"Quantity__c":15,"Product__r":{"Name":"Pieneen nälkään 3","CurrencyIsoCode":"EUR","Id":"a0LR0000002CQ7IMAW"},"CurrencyIsoCode":"EUR","Service_Time__c":"9:45","Product_Content__c":"Janssoninkiusausta\nV (92 more) ...","Product__c":"a0LR0000002CQ7IMAW","Unit_Price__c":3.00,"Id":"a0MR0000002MxGZMA0","Total_Net__c":45.00},{"Quantity__c":12,"Product__r":{"Name":"½ Pv.Kokouspkt I","CurrencyIsoCode":"EUR","Id":"a0LR0000002CQ7YMAW"},"CurrencyIsoCode":"EUR","Service_Time__c":"9:15","Product__c":"a0LR0000002CQ7YMAW","Unit_Price__c":3.00,"Id":"a0MR0000002IdVsMAK","Total_Net__c":36.00}]|0x30964412
14:10:02.144 (144764000)|METHOD_EXIT|[11]|01pR0000000ER63|generateServiceOrder.__sfdc_servingorder(LIST)
14:10:02.144 (144775000)|STATEMENT_EXECUTE|[22]
14:10:02.144 (144830000)|HEAP_ALLOCATE|[22]|Bytes:-4
14:10:02.144 (144841000)|HEAP_ALLOCATE|[22]|Bytes:14
14:10:02.144 (144860000)|HEAP_ALLOCATE|[22]|Bytes:-4
14:10:02.145 (145270000)|SOQL_EXECUTE_BEGIN|[22]|Aggregations:0|select Product__r.Name, Product_Content__c, Service_Time__c, Quantity__c, Unit_Price__c, Total_Net__c from Selected_Product__c where (Service_Reservation__c = :tmpVar1 and Billing_Category__c = :tmpVar2) order by Service_Time__c desc
14:10:02.151 (151663000)|SOQL_EXECUTE_END|[22]|Rows:1
14:10:02.151 (151683000)|HEAP_ALLOCATE|[22]|Bytes:8
14:10:02.151 (151701000)|HEAP_ALLOCATE|[22]|Bytes:327
14:10:02.151 (151724000)|HEAP_ALLOCATE|[22]|Bytes:331
14:10:02.151 (151751000)|METHOD_ENTRY|[22]|01pR0000000ER63|generateServiceOrder.__sfdc_addonservices(LIST)
14:10:02.151 (151782000)|HEAP_ALLOCATE|[4]|Bytes:20
14:10:02.151 (151800000)|HEAP_ALLOCATE|[4]|Bytes:20
14:10:02.151 (151825000)|HEAP_ALLOCATE|[4]|Bytes:20
14:10:02.151 (151840000)|HEAP_ALLOCATE|[4]|Bytes:20
14:10:02.151 (151859000)|VARIABLE_ASSIGNMENT|[-1]|this|{"servingorder":"0x6922acb"}|0x30964412
14:10:02.151 (151913000)|VARIABLE_ASSIGNMENT|[-1]|value|[{"Quantity__c":1,"Product__r":{"Name":"Astiat","CurrencyIsoCode":"EUR","Id":"a0LR0000002CQ8EMAW"},"CurrencyIsoCode":"EUR","Service_Time__c":"20:15","Product__c":"a0LR0000002CQ8EMAW","Unit_Price__c":60.00,"Id":"a0MR0000002MxGUMA0","Total_Net__c":60.00}]|0x18dde0dd
14:10:02.151 (151960000)|VARIABLE_ASSIGNMENT|[4]|this.addonservices|[{"Quantity__c":1,"Product__r":{"Name":"Astiat","CurrencyIsoCode":"EUR","Id":"a0LR0000002CQ8EMAW"},"CurrencyIsoCode":"EUR","Service_Time__c":"20:15","Product__c":"a0LR0000002CQ8EMAW","Unit_Price__c":60.00,"Id":"a0MR0000002MxGUMA0","Total_Net__c":60.00}]|0x30964412
14:10:02.151 (151980000)|METHOD_EXIT|[22]|01pR0000000ER63|generateServiceOrder.__sfdc_addonservices(LIST)
14:10:02.151 (151991000)|STATEMENT_EXECUTE|[33]
14:10:02.152 (152002000)|HEAP_ALLOCATE|[33]|Bytes:86
14:10:02.152 (152045000)|HEAP_ALLOCATE|[33]|Bytes:-4
14:10:02.152 (152296000)|SOQL_EXECUTE_BEGIN|[33]|Aggregations:0|select Total_Gross__c from Selected_Product__c where Service_Reservation__c = :tmpVar1
14:10:02.155 (155508000)|SOQL_EXECUTE_END|[33]|Rows:3
14:10:02.155 (155525000)|HEAP_ALLOCATE|[33]|Bytes:16
14:10:02.155 (155544000)|HEAP_ALLOCATE|[33]|Bytes:276
14:10:02.155 (155563000)|HEAP_ALLOCATE|[33]|Bytes:288
14:10:02.155 (155588000)|METHOD_ENTRY|[33]|01pR0000000ER63|generateServiceOrder.__sfdc_total(LIST)
14:10:02.155 (155615000)|HEAP_ALLOCATE|[5]|Bytes:20
14:10:02.155 (155639000)|HEAP_ALLOCATE|[5]|Bytes:20
14:10:02.155 (155663000)|HEAP_ALLOCATE|[5]|Bytes:20
14:10:02.155 (155678000)|HEAP_ALLOCATE|[5]|Bytes:20
14:10:02.155 (155697000)|VARIABLE_ASSIGNMENT|[-1]|this|{"addonservices":"0x956014b3","servingorder":"0x6922acb"}|0x30964412
14:10:02.155 (155742000)|VARIABLE_ASSIGNMENT|[-1]|value|[{"CurrencyIsoCode":"EUR","Id":"a0MR0000002IdVsMAK","Total_Gross__c":40.68},{"CurrencyIsoCode":"EUR","Id":"a0MR0000002MxGUMA0","Total_Gross__c":73.80},{"CurrencyIsoCode":"EUR","Id":"a0MR0000002MxGZMA0","Total_Gross__c":50.85}]|0x60880aa9
14:10:02.155 (155787000)|VARIABLE_ASSIGNMENT|[5]|this.total|[{"CurrencyIsoCode":"EUR","Id":"a0MR0000002IdVsMAK","Total_Gross__c":40.68},{"CurrencyIsoCode":"EUR","Id":"a0MR0000002MxGUMA0","Total_Gross__c":73.80},{"CurrencyIsoCode":"EUR","Id":"a0MR0000002MxGZMA0","Total_Gross__c":50.85}]|0x30964412
14:10:02.155 (155806000)|METHOD_EXIT|[33]|01pR0000000ER63|generateServiceOrder.__sfdc_total(LIST)
14:10:02.155 (155819000)|SYSTEM_MODE_EXIT|false
14:10:02.155 (155837000)|CODE_UNIT_FINISHED|generateServiceOrder 
14:10:02.177 (177507000)|CODE_UNIT_STARTED|[EXTERNAL]|01pR0000000ER63|generateServiceOrder get(servingorder)
14:10:02.177 (177525000)|SYSTEM_MODE_ENTER|true
14:10:02.177 (177542000)|CODE_UNIT_STARTED|[EXTERNAL]|01pR0000000ER63|servingorder
14:10:02.177 (177558000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:20
14:10:02.177 (177571000)|CODE_UNIT_FINISHED|servingorder
14:10:02.177 (177576000)|CODE_UNIT_FINISHED|generateServiceOrder get(servingorder)
14:10:02.178 (178604000)|CODE_UNIT_STARTED|[EXTERNAL]|01pR0000000ER63|generateServiceOrder get(addonservices)
14:10:02.178 (178614000)|SYSTEM_MODE_ENTER|true
14:10:02.178 (178625000)|CODE_UNIT_STARTED|[EXTERNAL]|01pR0000000ER63|addonservices
14:10:02.178 (178635000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:20
14:10:02.178 (178643000)|CODE_UNIT_FINISHED|addonservices
14:10:02.178 (178648000)|CODE_UNIT_FINISHED|generateServiceOrder get(addonservices)
14:10:02.196 (196521000)|CODE_UNIT_STARTED|[EXTERNAL]|01pR0000000ER63|generateServiceOrder get(totalNet)
14:10:02.196 (196536000)|SYSTEM_MODE_ENTER|true
14:10:02.196 (196550000)|CODE_UNIT_STARTED|[EXTERNAL]|01pR0000000ER63|totalNet
14:10:02.196 (196564000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:20
14:10:02.196 (196576000)|CODE_UNIT_FINISHED|totalNet
14:10:02.196 (196581000)|CODE_UNIT_FINISHED|generateServiceOrder get(totalNet)
14:10:02.433 (216222000)|CUMULATIVE_LIMIT_USAGE
14:10:02.433|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 3 out of 100
  Number of query rows: 6 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Number of script statements: 8 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

14:10:02.433|CUMULATIVE_LIMIT_USAGE_END

14:10:02.216 (216245000)|CODE_UNIT_FINISHED|VF: /apex/getServiceOrder
14:10:02.216 (216251000)|EXECUTION_FINISHED

 

Does anyone know what is the problem in here?. Seems like a pretty straightforward and simple problem.

 

Greetings,

 

MGA

 

bob_buzzardbob_buzzard

I think it may be because you have already declared a getter for totalNet here:

 

public decimal totalNet {get;set;}

 

try removing the auto get/set - that should then pick up your get method:

 

public decimal totalNet;