You need to sign in to do that
Don't have an account?
RarLopz
Visualforcepage Grand total not diplaying
I am trying to get the total count of all records in the list, and display it. Value not displaying .
<apex:page controller="CASReportController"> <apex:form > <apex:pageBlock title="JSON Deserialized Response"> <apex:pageBlockButtons > <apex:commandButton value="submit" action="{!deserialize}" reRender="DealerBlock"/> </apex:pageBlockButtons> <apex:pageBlockSection id="DealerBlock" columns="1" title="RollUp Summary > <apex:repeat value="{!wrapper}" var="cap1"> <apex:pageBlockTable value="{!cap1.caPerformanceRecordList}" var="cap" width="100%"> <apex:column headerValue="Reporting Period" value="{!cap.reportingPeriod}"/> <apex:column headerValue="FS Integration Type Code" value="{!cap.financeSourceIntegrationTypeCode}"/> <apex:column headerValue="IDL Plus" value="{!cap.idlPlus}"/> <apex:column headerValue="Credit Application Source Code" value="{!cap.creditApplicationSourceCode}"/> <apex:column headerValue="Submission Count" value="{!cap.submissionCount}" /> <!-- Generating CASubmissionCount total --> <apex:variable var="total" value="{!cap1.appTotal}" /> <!--footer of the SubmissionCount --> <apex:facet name="footer"> Total Count: <span class="t1"></span> <!-- expecting Total Count = 7 -- submissionCount of one record is 2 and other record is 7 as seen in json string > </apex:facet> </apex:pageBlockTable> </apex:repeat> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page> ------------------------------------------------------------ public with sharing class CASReportController { @AuraEnabled public list<JSONWrapperController> wrapper {get;set;} public void deserialize() { try{ string jsonresponse = '[{ "caPerformanceRecordList": [ { "submissionCount": 2 }, { "submissionCount": 5 } ], "ecPerformanceRecordList": [ { } ] }]'; wrapper = (list<JSONWrapperController>) JSON.deserialize(jsonresponse, list<JSONWrapperController>.class); } catch (Exception e){ system.debug('Error---->' + e.getLineNumber() + e.getMessage()); } } --------------------------------------------- public class JSONWrapperController { public List < CaPerformanceRecordList > caPerformanceRecordList{get;set;} public class CaPerformanceRecordList { public String motorDealerID{get;set;} public String dealerName{get;set;} public String reportingPeriod{get;set;} public String financeSourceIntegrationTypeCode{get;set;} public String idlPlus{get;set;} public String creditApplicationSourceCode{get;set;} } @AuraEnabled public integer getTotalAppCount() { // loop through each element in the caPerformanceRecordList, till the end of the list. // get grand total of submissionCount // return grand total integer appTotal = 0; for(CaPerformanceRecordList cp : caPerformanceRecordList) { appTotal += cp.submissionCount; } return appTotal; } }
- I read your problem and implemented it in my Org and it is working fine.
- Please use the below code [Solved] : -
--------------VF Page------------------
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.
All Answers
- I read your problem and implemented it in my Org and it is working fine.
- Please use the below code [Solved] : -
--------------VF Page------------------
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.
I am getting an error at the following lines
Also i notice a strange thing in the debug after the JSON String is deserialized and cast to the Wrapper class.
Notice how, it is incomplete.
USER_DEBUG [19]|DEBUG|This is the wrapper class:
(JSONWrapperController:[appTotal=null, caPerformanceRecordList=
(CaPerformanceRecordList:[creditApplicationSourceCode=STEONE, dealerName=Subaru Auto Dealer, financeSourceIntegrationTypeCode=FIFS, idlPlus=Y, reportingPeriod=2019-05-18, motorDealerID=XL1HX, submissionCount=2],
CaPerformanceRecordList:[creditApplicationSourceCode=RTEONE, dealerName=Subaru Auto Dealer, financeSourceIntegrationTypeCode=FIFS, idlPlus=Y, reportingPeriod=2019-06-27, motorDealerID=XL1HX, submission
Is my deserailizing technique incorrect/ am i not creating an incoorect data structure for the wrapper class?
Thank you.
I see the entire log when i open raw logs.
However I am still struggling with the first part of the question, error about InvalidType