function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ratu kucingratu kucing 

Why There is Different Value in system debug and variable that show in visualforcepage?

I have a program that can update ppd schedule time.
the code that I made now if I make changes to ppd schedule time and does not give a time lag before checking or saving data, then the data list does not match the updated data.
for example: I make changes to 5 data lists, if I immediately press the check button, only 4 data will be displayed (the last data is not included in the list), but if I check in system.debug, the five data have been entered into the list .
I really don't know what to do.
I have tried to give a breaktime before the data is displayed when pressing the check button, but it doesn't work, and if I give it more than 10 seconds it will get a cpu limit error
but if I give a time lag (just press the check button after a few seconds) then the data in the list matches the one in system.debug
this is my vfp code:
<apex:pageBlock >
   <apex:commandButton value="Check" action="{!check}" />
   <br/>
   {!updateDeliveryScheduleList}
</apex:pageBlock>

<apex:pageMessages id="pageMessages" />
<body>
    <apex:actionStatus startStyleClass="loadingMessage" startText="loading..." id="loadStatus">
    </apex:actionStatus>
    <apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
        <apex:tab label="Validate" name="validate" id="tabValidate">
            <apex:outputPanel id="wrapSalesPlanTable">
                <script>
                    j$(document).ready( function () {
                    j$('[id$="salesPlanTable"]').DataTable({iDisplayLength: 50, searching: false, dom: 'lBfrtip', stateSave: true, order: [], buttons: ['excel']});
                    });
                </script>
                <table id="salesPlanTable" class="stripe row-border order-column" style="width:100%"> 
                    <thead>
                        <tr>                                
                            <th id="columnA">PPD Delivery Schedule</th>
                            <th id="columnB">Check Opex</th>
                        </tr>
                    </thead>
                    <tbody>
                        <apex:repeat value="{!dataSalesPlan}" var="i">
                            <tr>
                                <th id="columnA">
                                    <apex:input type="date" value="{!i.deliverySchedulePPD}">
                                        <apex:actionSupport event="onblur" action="{!updateDeliverySchedule}" reRender="">
                                            <apex:param name="salesPlanIndex" value="{!i.index}" assignTo="{!salesPlanIndex}"/>
                                        </apex:actionSupport>
                                    </apex:input>
                                </th>
                                <th id="columnB">
                                    <apex:inputCheckbox styleClass="checkOpex{!i.spd.ID} checkOpex {!i.spd.ID}" value="{!i.opex}">
                                        <apex:actionSupport event="onchange" action="{!updateOpex}" reRender="">
                                           <apex:param name="salesPlanIndex" value="{!i.index}" assignTo="{!salesPlanIndex}"/>
                                        </apex:actionSupport>
                                    </apex:inputCheckbox>
                                </th>
                             </tr>
                        </apex:repeat>
                    </tbody>
                </table>
            </apex:outputPanel>
        </apex:tab>
    </apex:tabPanel>
</body>
this is my apex code:
public List<Sales_Plan_Detail__c> getDataSalesPlan {get;set;}
    public List<SPDWrapper> dataSalesPlan {get;set;}
    public Id[] updateSPDIds {get;set;}
    public Map<Id, Date> updateDeliveryScheduleList {get;set;}
    public Integer salesPlanIndex {get; set;}
    
    public UT_Checklist_Sales_Plan() { //constractor
        updateDeliveryScheduleList = new Map<Id, Date>();
    } 
        
    public void updateDeliverySchedule() {
        SPDWrapper spdWrapper = dataSalesPlan[salesPlanIndex];
        updateDeliveryScheduleList.put(spdWrapper.spd.Id, spdWrapper.deliverySchedulePPD); 
        if(!updateSPDIds.contains(spdWrapper.spd.Id)){
            updateSPDIds.add(spdWrapper.spd.Id);
        }
    }
    
    public void check(){
        datetime start = System.now();
        while (System.now() < start.addseconds(5)){
            //just to reload page to show value of updateDeliveryScheduleList.put
        }
    }

this is debug value (5 data)User-added image

this is vfp value (4 data)User-added image
A PandaA Panda
I see  that both are same only . Can you please highlight the difference?
ratu kucingratu kucing
 the different is on last data in list, in system debug there is last data with id: a0y0k0000053ye4eAA
but in list updateDeliveryScheduleList that i show in visualforce page there is no last data included.