• David Zhu 19
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi Guys,

I have a VF page, which loads the value when its opened based on SOQL query output.

When user modifies the input value, it should update on the same record whereas its not heppening for me.

Below is my code, and its very urgent. Can someone pls help me? as I am new to this development, I am struggling.

Controller:
public class EditQAAMController {
 Double MondayPrevet{get; set;}
    public Double EmpMap_Monday { get
    {
    return EmpMap.get('Monday');    
    }
    set
    {
        this.MondayPrevet = EmpMap_Monday;
    }
      }

public map<String,Double> EmpMap = new map<String, Double>();

 public EditQAAMController()
    {
         strText = ApexPages.currentPage().getParameters().get('str');
        System.debug(strText);
    }
    
    list<QAAM_Weekly_Planner__c> queryData;
    public void init()
    {
        queryData = [select CommentsAvailability__c, Other1Title__c, Other2Title__c, Picklist__c, Date_QAAM__c, Week_Start_Date__c,
                                                  Availability__c, ReasonAvailability__c, Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c,
                                                  File_Selection__c, Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c, 
                                                  Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, CPD_e_Learning_Maintenance__c, 
                                                  Coaching__c, PD_Days__c, One_on_Ones__c, Weekly_Tracker_preparation__c, Business_Communications__c, 
                                                  Other__c, Other1__c, Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, 
                                                  Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, Availability_Checking__c, id, Week__C 
                                                  from QAAM_Weekly_Planner__c where Week__C =: strText];
        list<String> weekDataStatic = new list<String>{'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
            integer i=0;
        for(QAAM_Weekly_Planner__c q : queryData)
        {
            dateInput = q.Week_Start_Date__c;
            EmpMap.put(weekDataStatic[i], q.Pre_Vet_Reviews__c);

}

/////This below method is called while doing the save action

 public void saveButton() {
         List<QAAM_Weekly_Planner__c> updateWeekValuetotal = new List<QAAM_Weekly_Planner__c>(); 
        for(QAAM_Weekly_Planner__c q : queryData)
        {
            q.Week_Start_Date__c = q.Week_Start_Date__c;
            System.debug('The value from UI is: ' +MondayPrevet); 
           q.Pre_Vet_Reviews__c = MondayPrevet;
            updateWeekValuetotal.add(q);
        }
        update updateWeekValuetotal;
    }

}