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
bharath kumar 52bharath kumar 52 

How to get values from return type object?

Hi All,

Following is the debug log that i am getting 
(
//list item 1
AppointmentBookingSlot:[BestSlotGrades=(GradeSlotResult:[Grade=100.00000000000000000000000000000000000, HeaderText=ASAP, IconName=clock-o, IsYesOrNoObjective=false, NumberOfAppointmentsWithGrade100=1, Objective=null, ObjectiveRecordTypeName=Objective_Asap, RankInAppointments=1, Text=1486735200000], 
GradeSlotResult:[Grade=100, HeaderText=Minimize Travel, IconName=car, IsYesOrNoObjective=false, NumberOfAppointmentsWithGrade100=24, Objective=null, ObjectiveRecordTypeName=Objective_Minimize_Travel, RankInAppointments=1, Text=null], 
GradeSlotResult:[Grade=100, HeaderText=Preferred Resource, IconName=users, IsYesOrNoObjective=true, NumberOfAppointmentsWithGrade100=24, Objective=null, ObjectiveRecordTypeName=Objective_PreferredEngineer, RankInAppointments=1, Text=null]), Grade=100.000000000000000000000000000000, 
Interval=TimeInterval:[2017-02-10 09:00:00,2017-02-10 11:00:00], SORT_BY_DATE=SORT_BY_DATE, SORT_BY_GRADE=SORT_BY_GRADE, SORT_BY_NO_SORT=SORT_BY_NO_SORT, SortByObjective=null, m_sortBy=SORT_BY_DATE],


// list item 2
AppointmentBookingSlot:[BestSlotGrades=(GradeSlotResult:[Grade=98.85057471264367816091954022988505800, HeaderText=ASAP, IconName=clock-o, IsYesOrNoObjective=false, NumberOfAppointmentsWithGrade100=1, Objective=null, ObjectiveRecordTypeName=Objective_Asap, RankInAppointments=2, Text=1486742400000], 
GradeSlotResult:[Grade=100, HeaderText=Minimize Travel, IconName=car, IsYesOrNoObjective=false, NumberOfAppointmentsWithGrade100=24, Objective=null, ObjectiveRecordTypeName=Objective_Minimize_Travel, RankInAppointments=2, Text=null], GradeSlotResult:[Grade=100, HeaderText=Preferred Resource, IconName=users, IsYesOrNoObjective=true, NumberOfAppointmentsWithGrade100=24, Objective=null, ObjectiveRecordTypeName=Objective_PreferredEngineer, RankInAppointments=2, Text=null]), Grade=99.0804597701149425287356321839080, Interval=TimeInterval:[2017-02-10 11:00:00,2017-02-10 13:00:00], SORT_BY_DATE=SORT_BY_DATE, SORT_BY_GRADE=SORT_BY_GRADE, SORT_BY_NO_SORT=SORT_BY_NO_SORT, SortByObjective=null, m_sortBy=SORT_BY_DATE])

I need to obtain Interval=TimeInterval:[2017-02-10 11:00:00,2017-02-10 13:00:00] and display it on a vf page.
This is a list of object----> i.e a managed package class called "​AppointmentBookingSlot". How can i parse this? 
Can someone provide me the pseudocode (like which data structure should be used to segregate) on how to proceed?

Any inputs would be very much helpful to me.


Thanks and Regards,

Bharath Kumar M

 

LBKLBK
Doesn't the AppointmentBookingSlot class exposes these values as attributes?
 
//List<AppointmentBookingSlot> lstAppointmentBookingSlot = new List<AppointmentBookingSlot> ();
List<AppointmentBookingSlot> lstAppointmentBookingSlot = (List<AppointmentBookingSlot>)YOUR_LIST_HERE;

for(AppointmentBookingSlot objAppointmentBookingSlot : lstAppointmentBookingSlot ){
    System.debug(objAppointmentBookingSlot.Interval);
}

 
bharath kumar 52bharath kumar 52
//Original lines of code

list<cksw_srvc.appointmentBookingSlot> availableSlots =CKSW_SRVC.AppointmentBookingService.GetSlots(service.Id, schedulePolicyId, slots, siteTZ); //I had tough time parsing this



//You suggestions

list<cksw_srvc.appointmentBookingSlot> availableSlots =(list<cksw_srvc.appointmentBookingSlot>)CKSW_SRVC.AppointmentBookingService.GetSlots(service.Id, schedulePolicyId, slots, siteTZ);

// This gives me the following output which is more likely accessible
---> objAppointmentBookingSlot|{"BestSlotGrades":"0x7c853532","Grade":90.4587155963302752293577981651376,"Interval":"0x66eef9cc"}
Hi LBK,

I believe the output coming from your suggestion is mostly parseable. Thanks a lot for your inputs. Will try displaying it and let you know the results.
 
bharath kumar 52bharath kumar 52
Controller :
public list<cksw_srvc.appointmentBookingSlot> displayTimeSlots(){

      // String full ;//= JSON.serialize(a);
        list<string> slist=new list<string>();
        id serviceId=service.Id;
        id siteId=site.id;
        system.debug('siteId>>>>>'+siteId);
        id schedulePolicyId = getSchedulePolicyId();


        addedslots = new list<cksw_srvc.appointmentBookingSlot>();


        cksw_base__calendar__c slots = 
                [SELECT 
                    id, cksw_base__exact_appointments__c, ( select id, cksw_base__start_time__c, cksw_base__finish_time__c, cksw_base__type__c, RecordType.DeveloperName  from cksw_base__days__r  )
                 FROM cksw_base__calendar__c 
                 WHERE name  = : appointmentSlotsCalendarName ];
            //Initial code -------> TimeZone siteTZ = TimeZone.getTimeZone(getSite(SiteId).time_zone__c);   
        TimeZone siteTZ = TimeZone.getTimeZone(site.time_zone__c);   //Modified by Bharath 
        system.debug('siteTZ >>>>>'+siteTZ+' SITEID >>'+siteId);          
        list<cksw_srvc.appointmentBookingSlot> availableSlots = (list<cksw_srvc.appointmentBookingSlot>)CKSW_SRVC.AppointmentBookingService.GetSlots(service.Id, schedulePolicyId, slots, siteTZ);
        system.debug('Inside displayTimeSlots >> availableSlots >> '+ availableSlots );

        //added at 1.05 today
        for(cksw_srvc.appointmentBookingSlot objAppointmentBookingSlot : availableSlots ){
            System.debug(objAppointmentBookingSlot.Interval);

            System.debug(objAppointmentBookingSlot.Grade);


            dt=objAppointmentBookingSlot.Interval.start;
            System.debug('START>>>>'+dt); //getting values in debug log for dt
            dt1=objAppointmentBookingSlot.Interval.finish;
            System.debug('finish>>>>'+dt1); //getting values in debug log for dt1


            if(addedslots.size()<3)
            addedslots.add(objAppointmentBookingSlot);



        }


        //system.debug('Inside displayTimeSlots >> availableSlots >> '+ availableSlots );

        return  addedslots;

    }






Page :

<apex:variable var="i" value="{!0}"/>
    <apex:repeat value="{!addedslots}" var="aptslot" >
    <apex:variable var="i" value="{!i+1}"/>
      <!-- <apex:commandLink value="{!cksw_srvc.appointmentBookingSlot.interval}"/> -->
      <div>{!TODAY()}<br/>
      <apex:commandLink value="{!dt} {!dt1}" action="{!slotSelection}" />
      </div>
     <!-- <apex:param value="{!dt}" name="dtval" assignTo="{!dtval}"/> -->
   </apex:repeat>

Hi LBK,

I am getting the values in debug logs. Any suggestions on how i can display those values in the vf page?
Above is the controller and vf page code. My vf page looks blank.
Thanks in anticipation