- Manoprabha Palpandian
- NEWBIE
- 50 Points
- Member since 2021
-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
19Questions
-
46Replies
Please Can Anyone help me i am creating a wrapper class this is correct or not ?
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:pageBlock>
            <apex:pageBlockButtons>
              <apex:commandButton action="{!ProcessSelected}" value="Show Selected accounts" reRender="block2"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="2">
              <apex:pageBlockTable value="{!wraplist}" var="wrapl">
                <apex:column>
                  <apex:facet name="header">
                    <apex:inputCheckbox />
                  </apex:facet>
                  <apex:inputCheckbox value="{!wrapl.isSelected}" id="InputId"/>
                </apex:column>
                <apex:column value ="{!wrapl.reg4.Name}"/>
                <apex:column value ="{!wrapl.reg4.FirstName__c}"/>
                <apex:column value ="{!wrapl.reg4.LastName__c}"/>
                <apex:column value ="{!wrapl.reg4.Email__c}"/>
                <apex:repeat value="{!wrapl.Hotels__r}" var="hotelwrap">
                  <apex:column value ="{!hotelwrap.reg4.Name}"/>
                  <apex:column value ="{!hotelwrap.reg4.Check_In_Date__c}"/>
                  <apex:column value ="{!hotelwrap.reg4.Check_Out_Date__c}"/>
                  <apex:column value ="{!hotelwrap.reg4.Hotel_Commands__c}"/>
                </apex:repeat>  Â
                <apex:repeat value="{!wrapl.AirTravels__r}" var="airwrap">Â
                  <apex:column value ="{!airwrap.reg4.Name}"/>
                  <apex:column value ="{!airwrap.reg4.Arrival__c}"/>
                  <apex:column value ="{!airwrap.reg4.Departure__c}"/>
                  <apex:column value ="{!airwrap.reg4.Air_Commands__c}"/>
                </apex:repeat>
                Â
              </apex:pageBlockTable>
              <apex:pageBlockTable value="{!selectedRegistration}" var="sa" id="block2">
                <apex:column value="{!sa.Name}"/>
                <apex:column value="{!sa.FirstName}"/>
                <apex:column value="{!sa.LastName}"/>
                <apex:column value="{!sa.Email}"/>
                <apex:repeat value="{!sa.Hotels__r}" var="hotelsa">Â
                  <apex:column value="{!hotelsa.Name}"/>
                  <apex:column value="{!hotelsa.Check_In_Date__c}"/>
                  <apex:column value="{!hotelsa.Check_Out_Date__c}"/>
                  <apex:column value="{!hotelsa.Hotel_Commands__c}"/>
                </apex:repeat>Â
                <apex:repeat value="{!sa.AirTravels__r}" var="airsa">Â
                  <apex:column value="{!airsa.Name}"/>
                  <apex:column value="{!airsa.Arrival__c}"/>
                  <apex:column value="{!airsa.Departure__c}"/>
                  <apex:column value="{!airsa.Air_Commands__c}"/>
                </apex:repeat>Â
              </apex:pageBlockTable>  Â
            </apex:pageBlockSection>
          </apex:pageBlock>
          Â
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public list<regwrapper> wraplist {get;set;}
  public list<Registration1__c> reglist {get;set;}
  public list<Hotel__c> hotellist {get;set;}
  public list<AirTravel__c> airlist {get;set;}
  public list<Registration1__c> selectedRegistration {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
    Â
    if(wraplist == null)
    {
      wraplist = new list<regwrapper>();
      for(Registration1__c reg3:[SELECT id,Name,FirstName__c,LastName__c,Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                    (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c])
      {
        wraplist.add(new regwrapper(reg3));
        Â
      }
      Â
      Â
    }
    Â
    Â
    Â
  }
  Â
  public void processSelected(){
    selectedRegistration = new list<Registration1__c>();
    for(regwrapper wrapobj:Wraplist){
      if(wrapobj.isSelected==true)
      {
        selectedRegistration.add(wrapobj.reg4);
      }
    }
  }
  Â
  public class regwrapper{
    public Registration1__c reg4{get;set;}
    Â
    public boolean isSelected{get;set;}
    Â
    public regwrapper(Registration1__c reg3)
    {
      reg4 = reg3;
      isselected = false;
    }
        Â
  }
   Â
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
       (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
    Â
    Â
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
Please help me its very urgent .
It showing an one error -Â Unknown property 'Registrationcontroller.regwrapper.Hotels__r'
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:pageBlock>
            <apex:pageBlockButtons>
              <apex:commandButton action="{!ProcessSelected}" value="Show Selected accounts" reRender="block2"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="2">
              <apex:pageBlockTable value="{!wraplist}" var="wrapl">
                <apex:column>
                  <apex:facet name="header">
                    <apex:inputCheckbox />
                  </apex:facet>
                  <apex:inputCheckbox value="{!wrapl.isSelected}" id="InputId"/>
                </apex:column>
                <apex:column value ="{!wrapl.reg4.Name}"/>
                <apex:column value ="{!wrapl.reg4.FirstName__c}"/>
                <apex:column value ="{!wrapl.reg4.LastName__c}"/>
                <apex:column value ="{!wrapl.reg4.Email__c}"/>
                <apex:repeat value="{!wrapl.Hotels__r}" var="hotelwrap">
                  <apex:column value ="{!hotelwrap.reg4.Name}"/>
                  <apex:column value ="{!hotelwrap.reg4.Check_In_Date__c}"/>
                  <apex:column value ="{!hotelwrap.reg4.Check_Out_Date__c}"/>
                  <apex:column value ="{!hotelwrap.reg4.Hotel_Commands__c}"/>
                </apex:repeat>  Â
                <apex:repeat value="{!wrapl.AirTravels__r}" var="airwrap">Â
                  <apex:column value ="{!airwrap.reg4.Name}"/>
                  <apex:column value ="{!airwrap.reg4.Arrival__c}"/>
                  <apex:column value ="{!airwrap.reg4.Departure__c}"/>
                  <apex:column value ="{!airwrap.reg4.Air_Commands__c}"/>
                </apex:repeat>
                Â
              </apex:pageBlockTable>
              <apex:pageBlockTable value="{!selectedRegistration}" var="sa" id="block2">
                <apex:column value="{!sa.Name}"/>
                <apex:column value="{!sa.FirstName}"/>
                <apex:column value="{!sa.LastName}"/>
                <apex:column value="{!sa.Email}"/>
                <apex:repeat value="{!sa.Hotels__r}" var="hotelsa">Â
                  <apex:column value="{!hotelsa.Name}"/>
                  <apex:column value="{!hotelsa.Check_In_Date__c}"/>
                  <apex:column value="{!hotelsa.Check_Out_Date__c}"/>
                  <apex:column value="{!hotelsa.Hotel_Commands__c}"/>
                </apex:repeat>Â
                <apex:repeat value="{!sa.AirTravels__r}" var="airsa">Â
                  <apex:column value="{!airsa.Name}"/>
                  <apex:column value="{!airsa.Arrival__c}"/>
                  <apex:column value="{!airsa.Departure__c}"/>
                  <apex:column value="{!airsa.Air_Commands__c}"/>
                </apex:repeat>Â
              </apex:pageBlockTable>  Â
            </apex:pageBlockSection>
          </apex:pageBlock>
          Â
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public list<regwrapper> wraplist {get;set;}
  public list<Registration1__c> reglist {get;set;}
  public list<Hotel__c> hotellist {get;set;}
  public list<AirTravel__c> airlist {get;set;}
  public list<Registration1__c> selectedRegistration {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
    Â
    if(wraplist == null)
    {
      wraplist = new list<regwrapper>();
      for(Registration1__c reg3:[SELECT id,Name,FirstName__c,LastName__c,Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                    (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c])
      {
        wraplist.add(new regwrapper(reg3));
        Â
      }
      Â
      Â
    }
    Â
    Â
    Â
  }
  Â
  public void processSelected(){
    selectedRegistration = new list<Registration1__c>();
    for(regwrapper wrapobj:Wraplist){
      if(wrapobj.isSelected==true)
      {
        selectedRegistration.add(wrapobj.reg4);
      }
    }
  }
  Â
  public class regwrapper{
    public Registration1__c reg4{get;set;}
    Â
    public boolean isSelected{get;set;}
    Â
    public regwrapper(Registration1__c reg3)
    {
      reg4 = reg3;
      isselected = false;
    }
        Â
  }
   Â
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
       (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
    Â
    Â
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
Please help me its very urgent .
It showing an one error -Â Unknown property 'Registrationcontroller.regwrapper.Hotels__r'
- Manoprabha Palpandian
- August 02, 2021
- Like
- 0
please help me its very urgent I created a wrapper class one parent object and two child objects air and hotel . tthis code is correct or not
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:pageBlock>
            <apex:pageBlockButtons>
              <apex:commandButton action="{!ProcessSelected}" value="Show Selected accounts" reRender="block2"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="2">
              <apex:pageBlockTable value="{!wraplist}" var="wrapl">
                <apex:column>
                  <apex:facet name="header">
                    <apex:inputCheckbox />
                  </apex:facet>
                  <apex:inputCheckbox value="{!wrapl.isSelected}" id="InputId"/>
                </apex:column>
                <apex:column value ="{!wrapl.reg4.Name}"/>
                <apex:column value ="{!wrapl.reg4.FirstName__c}"/>
                <apex:column value ="{!wrapl.reg4.LastName__c}"/>
                <apex:column value ="{!wrapl.reg4.Email__c}"/>
                <apex:repeat value="{!wrapl.Hotels__r}" var="hotelwrap">
                <apex:column value ="{!hotelwrap.reg4.Name}"/>
                <apex:column value ="{!hotelwrap.reg4.Check_In_Date__c}"/>
                <apex:column value ="{!hotelwrap.reg4.Check_Out_Date__c}"/>
                <apex:column value ="{!hotelwrap.reg4.Hotel_Commands__c}"/>
                </apex:repeat>  Â
                <apex:repeat value="{!wrapl.AirTravels__r}" var="airwrap">Â
                <apex:column value ="{!airwrap.reg4.Name}"/>
                <apex:column value ="{!airwrap.reg4.Arrival__c}"/>
                <apex:column value ="{!airwrap.reg4.Departure__c}"/>
                <apex:column value ="{!airwrap.reg4.Air_Commands__c}"/>
                </apex:repeat>
               Â
              </apex:pageBlockTable>
              <apex:pageBlockTable value="{!selectedRegistration}" var="sa" id="block2">
                <apex:column value="{!sa.Name}"/>
                <apex:column value="{!sa.FirstName}"/>
                <apex:column value="{!sa.LastName}"/>
                <apex:column value="{!sa.Email}"/>
                <apex:repeat value="{!sa.Hotels__r}" var="hotelsa">Â
                <apex:column value="{!hotelsa.Name}"/>
                  <apex:column value="{!hotelsa.Check_In_Date__c}"/>
                  <apex:column value="{!hotelsa.Check_Out_Date__c}"/>
                  <apex:column value="{!hotelsa.Hotel_Commands__c}"/>
                </apex:repeat>Â
                <apex:repeat value="{!sa.AirTravels__r}" var="airsa">Â
                <apex:column value="{!airsa.Name}"/>
                  <apex:column value="{!airsa.Arrival__c}"/>
                  <apex:column value="{!airsa.Departure__c}"/>
                  <apex:column value="{!airsa.Air_Commands__c}"/>
                </apex:repeat>Â
               Â
               Â
              Â
                Â
              </apex:pageBlockTable>
              Â
            </apex:pageBlockSection>
          </apex:pageBlock>
         Â
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
------------------------------ APEX CLASS-------------------------------------------
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public list<regwrapper> wraplist {get;set;}
  public list<Registration1__c> reglist {get;set;}
  public list<Hotel__c> hotellist {get;set;}
  public list<AirTravel__c> airlist {get;set;}
  public list<Registration1__c> selectedRegistration {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
    Â
    if(wraplist == null)
     {
      wraplist = new list<regwrapper>();
      for(Registration1__c reg3:[SELECT id,Name,FirstName__c,LastName__c,Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                    (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c])
                    {
                      wraplist.add(new regwrapper(reg3));
                   Â
                    }
   Â
     Â
     }
    Â
    Â
    Â
  }
  Â
  public void processSelected(){
    selectedRegistration = new list<Registration1__c>();
    for(regwrapper wrapobj:Wraplist){
      if(wrapobj.isSelected==true)
      {
        selectedRegistration.add(wrapobj.reg4);
        }
    }
  }
    Â
  Â
 Â
  Â
  public class regwrapper{
    public Registration1__c reg4{get;set;}
    Â
    public boolean isSelected{get;set;}
    Â
    public regwrapper(Registration1__c reg3)
    {
      reg4 = reg3;
      isselected = false;
    }
    Â
    Â
  }
  Â
  Â
  Â
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
 public void editfunction() {
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
   Â
    Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
please checkit and tellme how to create it
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:pageBlock>
            <apex:pageBlockButtons>
              <apex:commandButton action="{!ProcessSelected}" value="Show Selected accounts" reRender="block2"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="2">
              <apex:pageBlockTable value="{!wraplist}" var="wrapl">
                <apex:column>
                  <apex:facet name="header">
                    <apex:inputCheckbox />
                  </apex:facet>
                  <apex:inputCheckbox value="{!wrapl.isSelected}" id="InputId"/>
                </apex:column>
                <apex:column value ="{!wrapl.reg4.Name}"/>
                <apex:column value ="{!wrapl.reg4.FirstName__c}"/>
                <apex:column value ="{!wrapl.reg4.LastName__c}"/>
                <apex:column value ="{!wrapl.reg4.Email__c}"/>
                <apex:repeat value="{!wrapl.Hotels__r}" var="hotelwrap">
                <apex:column value ="{!hotelwrap.reg4.Name}"/>
                <apex:column value ="{!hotelwrap.reg4.Check_In_Date__c}"/>
                <apex:column value ="{!hotelwrap.reg4.Check_Out_Date__c}"/>
                <apex:column value ="{!hotelwrap.reg4.Hotel_Commands__c}"/>
                </apex:repeat>  Â
                <apex:repeat value="{!wrapl.AirTravels__r}" var="airwrap">Â
                <apex:column value ="{!airwrap.reg4.Name}"/>
                <apex:column value ="{!airwrap.reg4.Arrival__c}"/>
                <apex:column value ="{!airwrap.reg4.Departure__c}"/>
                <apex:column value ="{!airwrap.reg4.Air_Commands__c}"/>
                </apex:repeat>
               Â
              </apex:pageBlockTable>
              <apex:pageBlockTable value="{!selectedRegistration}" var="sa" id="block2">
                <apex:column value="{!sa.Name}"/>
                <apex:column value="{!sa.FirstName}"/>
                <apex:column value="{!sa.LastName}"/>
                <apex:column value="{!sa.Email}"/>
                <apex:repeat value="{!sa.Hotels__r}" var="hotelsa">Â
                <apex:column value="{!hotelsa.Name}"/>
                  <apex:column value="{!hotelsa.Check_In_Date__c}"/>
                  <apex:column value="{!hotelsa.Check_Out_Date__c}"/>
                  <apex:column value="{!hotelsa.Hotel_Commands__c}"/>
                </apex:repeat>Â
                <apex:repeat value="{!sa.AirTravels__r}" var="airsa">Â
                <apex:column value="{!airsa.Name}"/>
                  <apex:column value="{!airsa.Arrival__c}"/>
                  <apex:column value="{!airsa.Departure__c}"/>
                  <apex:column value="{!airsa.Air_Commands__c}"/>
                </apex:repeat>Â
               Â
               Â
              Â
                Â
              </apex:pageBlockTable>
              Â
            </apex:pageBlockSection>
          </apex:pageBlock>
         Â
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
------------------------------ APEX CLASS-------------------------------------------
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public list<regwrapper> wraplist {get;set;}
  public list<Registration1__c> reglist {get;set;}
  public list<Hotel__c> hotellist {get;set;}
  public list<AirTravel__c> airlist {get;set;}
  public list<Registration1__c> selectedRegistration {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
    Â
    if(wraplist == null)
     {
      wraplist = new list<regwrapper>();
      for(Registration1__c reg3:[SELECT id,Name,FirstName__c,LastName__c,Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                    (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c])
                    {
                      wraplist.add(new regwrapper(reg3));
                   Â
                    }
   Â
     Â
     }
    Â
    Â
    Â
  }
  Â
  public void processSelected(){
    selectedRegistration = new list<Registration1__c>();
    for(regwrapper wrapobj:Wraplist){
      if(wrapobj.isSelected==true)
      {
        selectedRegistration.add(wrapobj.reg4);
        }
    }
  }
    Â
  Â
 Â
  Â
  public class regwrapper{
    public Registration1__c reg4{get;set;}
    Â
    public boolean isSelected{get;set;}
    Â
    public regwrapper(Registration1__c reg3)
    {
      reg4 = reg3;
      isselected = false;
    }
    Â
    Â
  }
  Â
  Â
  Â
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
 public void editfunction() {
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
   Â
    Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
please checkit and tellme how to create it
- Manoprabha Palpandian
- July 29, 2021
- Like
- 0
Can any one explain what is wrapper class and in my code how to use it
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
       set<Id> HotelIds = new set<Id>();
         set<Id> AirTravelIds = new set<Id>();
     Â
      for(Registration1__c reg1 : [SELECT Id,Name, FirstName__c, LastName__c, Email__c,Â
                     (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                  (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
                  FROM Registration1__c where id=:editid]){
                           for(Hotel__c Hotel : reg1.Hotels__r){
                           HotelIds.add(Hotel.Id);  Â
                           }
                  for(AirTravel__c AirTravels : reg1.AirTravels__r){
                           AirTravelIds.add(AirTravels.Id);  Â
                           }                          Â
                           }
    Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
       set<Id> HotelIds = new set<Id>();
         set<Id> AirTravelIds = new set<Id>();
     Â
      for(Registration1__c reg1 : [SELECT Id,Name, FirstName__c, LastName__c, Email__c,Â
                     (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                  (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
                  FROM Registration1__c where id=:editid]){
                           for(Hotel__c Hotel : reg1.Hotels__r){
                           HotelIds.add(Hotel.Id);  Â
                           }
                  for(AirTravel__c AirTravels : reg1.AirTravels__r){
                           AirTravelIds.add(AirTravels.Id);  Â
                           }                          Â
                           }
    Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
- Manoprabha Palpandian
- July 28, 2021
- Like
- 0
If it is correct or not any one help me
public void editfunction() {
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
    hotel.get('id');
    air.get('id');
    Â
    }
how to get a child record values
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
    hotel.get('id');
    air.get('id');
    Â
    }
how to get a child record values
- Manoprabha Palpandian
- July 26, 2021
- Like
- 0
Can any one help me when i click the edit button child record values also stored how to write a code
public void editfunction() {
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
    Â
   Â
   Â
    }
how to get the child record values please any one helpme how to write it.
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
    Â
   Â
   Â
    }
how to get the child record values please any one helpme how to write it.
- Manoprabha Palpandian
- July 26, 2021
- Like
- 0
If I click the edit button display my child record in my editfunction code i query the all fields and how to get the record when i click
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public String editid1 {get;set;}
  public String editid2 {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
   Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
         <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
Â
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public String editid1 {get;set;}
  public String editid2 {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
   Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
         <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
Â
- Manoprabha Palpandian
- July 26, 2021
- Like
- 0
if i click the edit button show all the values in my record but registration values showing not display the atr and hotel values
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="HoTel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
          Â
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
          Â
        </apex:repeat>
        Â
        Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            <apex:param name="cid1" value="{!regvalue.id}" assignto="{!editid1}"/>
            <apex:param name="cid2" value="{!regvalue.id}" assignto="{!editid2}"/>
            Â
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            <apex:param name="cid1" value="{!regvalue.id}" assignto="{!editid1}"/>
            <apex:param name="cid2" value="{!regvalue.id}" assignto="{!editid2}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public String editid1 {get;set;}
  public String editid2 {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  Â
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    system.debug('editfunction inside===>'+editid1);
    system.debug('editfunction inside===>'+editid2);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c
       FROM Registration1__c where id=:editid];
    Â
    Â
    List<Hotel__c> hotel2=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid1];
    List<AirTravel__c> air2=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid2];
    Â
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    List<Hotel__c> hotel1=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid1];
    List<AirTravel__c> air1=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid2];
    Â
    delete reg2;
    delete hotel1;
    delete air1;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
how to showing the all values in my record can anyone helpme
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="HoTel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
          Â
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
          Â
        </apex:repeat>
        Â
        Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            <apex:param name="cid1" value="{!regvalue.id}" assignto="{!editid1}"/>
            <apex:param name="cid2" value="{!regvalue.id}" assignto="{!editid2}"/>
            Â
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            <apex:param name="cid1" value="{!regvalue.id}" assignto="{!editid1}"/>
            <apex:param name="cid2" value="{!regvalue.id}" assignto="{!editid2}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public String editid1 {get;set;}
  public String editid2 {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  Â
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    system.debug('editfunction inside===>'+editid1);
    system.debug('editfunction inside===>'+editid2);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c
       FROM Registration1__c where id=:editid];
    Â
    Â
    List<Hotel__c> hotel2=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid1];
    List<AirTravel__c> air2=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid2];
    Â
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    List<Hotel__c> hotel1=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid1];
    List<AirTravel__c> air1=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid2];
    Â
    delete reg2;
    delete hotel1;
    delete air1;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
how to showing the all values in my record can anyone helpme
- Manoprabha Palpandian
- July 23, 2021
- Like
- 0
my coding is running if i click the edit button showing an error
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  Â
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT id,name FROM Hotels__r),
         (SELECT id,name FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c
       FROM Registration1__c where id=:editid];
    hotel=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid];
    air=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid];
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    List<Hotel__c> hotel1=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid];
    List<AirTravel__c> air1=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid];
    Â
    delete reg2;
    delete hotel1;
    delete air1;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        //reg1 = new Registration1__c();
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="HoTel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column value="{!c.Name}"/>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column value="{!d.Name}"/>
        </apex:repeat>
        Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            Â
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            Â
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
ERROR IS:Â
List has no rows for assignment to SObject
Error is in expression '{!editfunction}' in page registrationnew: Class.Registrationcontroller.editfunction: line 23, column 1
An unexpected error has occurred. Your development organization has been notified.
WHAT IS THE MISTAKE IN MY code editfunction() method
please anyone helpme
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  Â
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT id,name FROM Hotels__r),
         (SELECT id,name FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c
       FROM Registration1__c where id=:editid];
    hotel=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid];
    air=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid];
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    List<Hotel__c> hotel1=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid];
    List<AirTravel__c> air1=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid];
    Â
    delete reg2;
    delete hotel1;
    delete air1;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        //reg1 = new Registration1__c();
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="HoTel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column value="{!c.Name}"/>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column value="{!d.Name}"/>
        </apex:repeat>
        Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            Â
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            Â
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
ERROR IS:Â
List has no rows for assignment to SObject
Error is in expression '{!editfunction}' in page registrationnew: Class.Registrationcontroller.editfunction: line 23, column 1
An unexpected error has occurred. Your development organization has been notified.
WHAT IS THE MISTAKE IN MY code editfunction() method
please anyone helpme
- Manoprabha Palpandian
- July 09, 2021
- Like
- 0
Can anyone helpme i have two child objects that are connected in one parent object how to save the record after the parent reccord savedd
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
   }
   public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT id,name FROM Hotels__r),
         (SELECT id,name FROM AirTravels__r) FROM Registration1__c];
    return listreg;
   }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id, Name, FirstName__c, LastName__c, Email__c FROM Registration1__c where id=:editid];
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c FROM Registration1__c where id=:editid];
    Â
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        reg1 = new Registration1__c();
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        Â
          <apex:repeat value="{!regvalue.Hotels__r}" var="c">
            <apex:column value="{!c.Name}"/>
          </apex:repeat>
          <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
            <apex:column value="{!d.Name}"/>
          </apex:repeat>
       Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>  Â
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
I am new for coding please help me
Custom Object - AirTravel, Fields - Arrival and Departure Datatype- Picklist. Custom Object - Hotel, Fields - Check In Date and Check Out Date Datatype- Picklist. These two custom objects lookup with Registraton1__c. How to give Hotels and Airtravel lookupvalues in reagistration1__c
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
   }
   public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT id,name FROM Hotels__r),
         (SELECT id,name FROM AirTravels__r) FROM Registration1__c];
    return listreg;
   }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id, Name, FirstName__c, LastName__c, Email__c FROM Registration1__c where id=:editid];
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c FROM Registration1__c where id=:editid];
    Â
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        reg1 = new Registration1__c();
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        Â
          <apex:repeat value="{!regvalue.Hotels__r}" var="c">
            <apex:column value="{!c.Name}"/>
          </apex:repeat>
          <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
            <apex:column value="{!d.Name}"/>
          </apex:repeat>
       Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>  Â
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
I am new for coding please help me
Custom Object - AirTravel, Fields - Arrival and Departure Datatype- Picklist. Custom Object - Hotel, Fields - Check In Date and Check Out Date Datatype- Picklist. These two custom objects lookup with Registraton1__c. How to give Hotels and Airtravel lookupvalues in reagistration1__c
- Manoprabha Palpandian
- July 08, 2021
- Like
- 0
- Manoprabha Palpandian
- July 07, 2021
- Like
- 0
missing required attribute value in my code showing error
:pageBlockTable>
       <apex:pageBlock title="Registration Records">
       <apex:outputPanel id="ContactDetail" >
       <apex:repeat value="{!Registration details}" var="reg">
       <apex:outputText value="{!reg.Name__c}" /><br/>
         <apex:outputText value="{!reg.Address__c}" /><br/>
         <apex:outputText value="{!reg.Email_ID__c}" /><br/>
         <apex:outputText value="{!reg.College_Name__c}" /><br/>
        </apex:repeat>
        </apex:outputPanel>
       </apex:pageBlock>
      </apex:pageBlockTable>
        Â
        Â
       <apex:pageBlock title="Registration Records">
       <apex:outputPanel id="ContactDetail" >
       <apex:repeat value="{!Registration details}" var="reg">
       <apex:outputText value="{!reg.Name__c}" /><br/>
         <apex:outputText value="{!reg.Address__c}" /><br/>
         <apex:outputText value="{!reg.Email_ID__c}" /><br/>
         <apex:outputText value="{!reg.College_Name__c}" /><br/>
        </apex:repeat>
        </apex:outputPanel>
       </apex:pageBlock>
      </apex:pageBlockTable>
        Â
        Â
- Manoprabha Palpandian
- July 02, 2021
- Like
- 0
- Manoprabha Palpandian
- July 01, 2021
- Like
- 0
please help me its very urgent I created a wrapper class one parent object and two child objects air and hotel . tthis code is correct or not
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:pageBlock>
            <apex:pageBlockButtons>
              <apex:commandButton action="{!ProcessSelected}" value="Show Selected accounts" reRender="block2"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="2">
              <apex:pageBlockTable value="{!wraplist}" var="wrapl">
                <apex:column>
                  <apex:facet name="header">
                    <apex:inputCheckbox />
                  </apex:facet>
                  <apex:inputCheckbox value="{!wrapl.isSelected}" id="InputId"/>
                </apex:column>
                <apex:column value ="{!wrapl.reg4.Name}"/>
                <apex:column value ="{!wrapl.reg4.FirstName__c}"/>
                <apex:column value ="{!wrapl.reg4.LastName__c}"/>
                <apex:column value ="{!wrapl.reg4.Email__c}"/>
                <apex:repeat value="{!wrapl.Hotels__r}" var="hotelwrap">
                <apex:column value ="{!hotelwrap.reg4.Name}"/>
                <apex:column value ="{!hotelwrap.reg4.Check_In_Date__c}"/>
                <apex:column value ="{!hotelwrap.reg4.Check_Out_Date__c}"/>
                <apex:column value ="{!hotelwrap.reg4.Hotel_Commands__c}"/>
                </apex:repeat>  Â
                <apex:repeat value="{!wrapl.AirTravels__r}" var="airwrap">Â
                <apex:column value ="{!airwrap.reg4.Name}"/>
                <apex:column value ="{!airwrap.reg4.Arrival__c}"/>
                <apex:column value ="{!airwrap.reg4.Departure__c}"/>
                <apex:column value ="{!airwrap.reg4.Air_Commands__c}"/>
                </apex:repeat>
               Â
              </apex:pageBlockTable>
              <apex:pageBlockTable value="{!selectedRegistration}" var="sa" id="block2">
                <apex:column value="{!sa.Name}"/>
                <apex:column value="{!sa.FirstName}"/>
                <apex:column value="{!sa.LastName}"/>
                <apex:column value="{!sa.Email}"/>
                <apex:repeat value="{!sa.Hotels__r}" var="hotelsa">Â
                <apex:column value="{!hotelsa.Name}"/>
                  <apex:column value="{!hotelsa.Check_In_Date__c}"/>
                  <apex:column value="{!hotelsa.Check_Out_Date__c}"/>
                  <apex:column value="{!hotelsa.Hotel_Commands__c}"/>
                </apex:repeat>Â
                <apex:repeat value="{!sa.AirTravels__r}" var="airsa">Â
                <apex:column value="{!airsa.Name}"/>
                  <apex:column value="{!airsa.Arrival__c}"/>
                  <apex:column value="{!airsa.Departure__c}"/>
                  <apex:column value="{!airsa.Air_Commands__c}"/>
                </apex:repeat>Â
               Â
               Â
              Â
                Â
              </apex:pageBlockTable>
              Â
            </apex:pageBlockSection>
          </apex:pageBlock>
         Â
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
------------------------------ APEX CLASS-------------------------------------------
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public list<regwrapper> wraplist {get;set;}
  public list<Registration1__c> reglist {get;set;}
  public list<Hotel__c> hotellist {get;set;}
  public list<AirTravel__c> airlist {get;set;}
  public list<Registration1__c> selectedRegistration {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
    Â
    if(wraplist == null)
     {
      wraplist = new list<regwrapper>();
      for(Registration1__c reg3:[SELECT id,Name,FirstName__c,LastName__c,Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                    (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c])
                    {
                      wraplist.add(new regwrapper(reg3));
                   Â
                    }
   Â
     Â
     }
    Â
    Â
    Â
  }
  Â
  public void processSelected(){
    selectedRegistration = new list<Registration1__c>();
    for(regwrapper wrapobj:Wraplist){
      if(wrapobj.isSelected==true)
      {
        selectedRegistration.add(wrapobj.reg4);
        }
    }
  }
    Â
  Â
 Â
  Â
  public class regwrapper{
    public Registration1__c reg4{get;set;}
    Â
    public boolean isSelected{get;set;}
    Â
    public regwrapper(Registration1__c reg3)
    {
      reg4 = reg3;
      isselected = false;
    }
    Â
    Â
  }
  Â
  Â
  Â
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
 public void editfunction() {
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
   Â
    Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
please checkit and tellme how to create it
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:pageBlock>
            <apex:pageBlockButtons>
              <apex:commandButton action="{!ProcessSelected}" value="Show Selected accounts" reRender="block2"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="2">
              <apex:pageBlockTable value="{!wraplist}" var="wrapl">
                <apex:column>
                  <apex:facet name="header">
                    <apex:inputCheckbox />
                  </apex:facet>
                  <apex:inputCheckbox value="{!wrapl.isSelected}" id="InputId"/>
                </apex:column>
                <apex:column value ="{!wrapl.reg4.Name}"/>
                <apex:column value ="{!wrapl.reg4.FirstName__c}"/>
                <apex:column value ="{!wrapl.reg4.LastName__c}"/>
                <apex:column value ="{!wrapl.reg4.Email__c}"/>
                <apex:repeat value="{!wrapl.Hotels__r}" var="hotelwrap">
                <apex:column value ="{!hotelwrap.reg4.Name}"/>
                <apex:column value ="{!hotelwrap.reg4.Check_In_Date__c}"/>
                <apex:column value ="{!hotelwrap.reg4.Check_Out_Date__c}"/>
                <apex:column value ="{!hotelwrap.reg4.Hotel_Commands__c}"/>
                </apex:repeat>  Â
                <apex:repeat value="{!wrapl.AirTravels__r}" var="airwrap">Â
                <apex:column value ="{!airwrap.reg4.Name}"/>
                <apex:column value ="{!airwrap.reg4.Arrival__c}"/>
                <apex:column value ="{!airwrap.reg4.Departure__c}"/>
                <apex:column value ="{!airwrap.reg4.Air_Commands__c}"/>
                </apex:repeat>
               Â
              </apex:pageBlockTable>
              <apex:pageBlockTable value="{!selectedRegistration}" var="sa" id="block2">
                <apex:column value="{!sa.Name}"/>
                <apex:column value="{!sa.FirstName}"/>
                <apex:column value="{!sa.LastName}"/>
                <apex:column value="{!sa.Email}"/>
                <apex:repeat value="{!sa.Hotels__r}" var="hotelsa">Â
                <apex:column value="{!hotelsa.Name}"/>
                  <apex:column value="{!hotelsa.Check_In_Date__c}"/>
                  <apex:column value="{!hotelsa.Check_Out_Date__c}"/>
                  <apex:column value="{!hotelsa.Hotel_Commands__c}"/>
                </apex:repeat>Â
                <apex:repeat value="{!sa.AirTravels__r}" var="airsa">Â
                <apex:column value="{!airsa.Name}"/>
                  <apex:column value="{!airsa.Arrival__c}"/>
                  <apex:column value="{!airsa.Departure__c}"/>
                  <apex:column value="{!airsa.Air_Commands__c}"/>
                </apex:repeat>Â
               Â
               Â
              Â
                Â
              </apex:pageBlockTable>
              Â
            </apex:pageBlockSection>
          </apex:pageBlock>
         Â
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
------------------------------ APEX CLASS-------------------------------------------
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public list<regwrapper> wraplist {get;set;}
  public list<Registration1__c> reglist {get;set;}
  public list<Hotel__c> hotellist {get;set;}
  public list<AirTravel__c> airlist {get;set;}
  public list<Registration1__c> selectedRegistration {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
    Â
    if(wraplist == null)
     {
      wraplist = new list<regwrapper>();
      for(Registration1__c reg3:[SELECT id,Name,FirstName__c,LastName__c,Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                    (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c])
                    {
                      wraplist.add(new regwrapper(reg3));
                   Â
                    }
   Â
     Â
     }
    Â
    Â
    Â
  }
  Â
  public void processSelected(){
    selectedRegistration = new list<Registration1__c>();
    for(regwrapper wrapobj:Wraplist){
      if(wrapobj.isSelected==true)
      {
        selectedRegistration.add(wrapobj.reg4);
        }
    }
  }
    Â
  Â
 Â
  Â
  public class regwrapper{
    public Registration1__c reg4{get;set;}
    Â
    public boolean isSelected{get;set;}
    Â
    public regwrapper(Registration1__c reg3)
    {
      reg4 = reg3;
      isselected = false;
    }
    Â
    Â
  }
  Â
  Â
  Â
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
 public void editfunction() {
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
   Â
    Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
please checkit and tellme how to create it
- Manoprabha Palpandian
- July 29, 2021
- Like
- 0
Can any one explain what is wrapper class and in my code how to use it
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
       set<Id> HotelIds = new set<Id>();
         set<Id> AirTravelIds = new set<Id>();
     Â
      for(Registration1__c reg1 : [SELECT Id,Name, FirstName__c, LastName__c, Email__c,Â
                     (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                  (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
                  FROM Registration1__c where id=:editid]){
                           for(Hotel__c Hotel : reg1.Hotels__r){
                           HotelIds.add(Hotel.Id);  Â
                           }
                  for(AirTravel__c AirTravels : reg1.AirTravels__r){
                           AirTravelIds.add(AirTravels.Id);  Â
                           }                          Â
                           }
    Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
       set<Id> HotelIds = new set<Id>();
         set<Id> AirTravelIds = new set<Id>();
     Â
      for(Registration1__c reg1 : [SELECT Id,Name, FirstName__c, LastName__c, Email__c,Â
                     (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
                  (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
                  FROM Registration1__c where id=:editid]){
                           for(Hotel__c Hotel : reg1.Hotels__r){
                           HotelIds.add(Hotel.Id);  Â
                           }
                  for(AirTravel__c AirTravels : reg1.AirTravels__r){
                           AirTravelIds.add(AirTravels.Id);  Â
                           }                          Â
                           }
    Â
    }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c  where id=:editid];
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="Hotel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
        </apex:repeat>
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
- Manoprabha Palpandian
- July 28, 2021
- Like
- 0
If it is correct or not any one help me
public void editfunction() {
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
    hotel.get('id');
    air.get('id');
    Â
    }
how to get a child record values
    system.debug('editfunction inside===>'+editid);
        reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r)
       FROM Registration1__c where id=:editid];
    hotel.get('id');
    air.get('id');
    Â
    }
how to get a child record values
- Manoprabha Palpandian
- July 26, 2021
- Like
- 0
if i click the edit button show all the values in my record but registration values showing not display the atr and hotel values
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="HoTel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
          Â
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
          Â
        </apex:repeat>
        Â
        Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            <apex:param name="cid1" value="{!regvalue.id}" assignto="{!editid1}"/>
            <apex:param name="cid2" value="{!regvalue.id}" assignto="{!editid2}"/>
            Â
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            <apex:param name="cid1" value="{!regvalue.id}" assignto="{!editid1}"/>
            <apex:param name="cid2" value="{!regvalue.id}" assignto="{!editid2}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public String editid1 {get;set;}
  public String editid2 {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  Â
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    system.debug('editfunction inside===>'+editid1);
    system.debug('editfunction inside===>'+editid2);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c
       FROM Registration1__c where id=:editid];
    Â
    Â
    List<Hotel__c> hotel2=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid1];
    List<AirTravel__c> air2=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid2];
    Â
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    List<Hotel__c> hotel1=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid1];
    List<AirTravel__c> air1=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid2];
    Â
    delete reg2;
    delete hotel1;
    delete air1;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
how to showing the all values in my record can anyone helpme
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="HoTel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column headerValue="Hotel ID"> <apex:outputText value="{!c.Name}"/></apex:column>
          <apex:column headerValue="CheckInDate"> <apex:outputText value="{!c.Check_In_Date__c}"/></apex:column>
          <apex:column headerValue="CheckOutDate"><apex:outputText value="{!c.Check_Out_Date__c}"/></apex:column>
          <apex:column headerValue="Hotel Commands"><apex:outputText value="{!c.Hotel_Commands__c}"/></apex:column>
          Â
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column headerValue="Air ID"><apex:outputText value="{!d.Name}"/></apex:column>
          <apex:column headerValue="Arrival"><apex:outputText value="{!d.Arrival__c}"/></apex:column>
          <apex:column headerValue="Departure"><apex:outputText value="{!d.Departure__c}"/></apex:column>
          <apex:column headerValue="Air Commands"><apex:outputText value="{!d.Air_Commands__c}"/></apex:column>
          Â
        </apex:repeat>
        Â
        Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            <apex:param name="cid1" value="{!regvalue.id}" assignto="{!editid1}"/>
            <apex:param name="cid2" value="{!regvalue.id}" assignto="{!editid2}"/>
            Â
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            <apex:param name="cid1" value="{!regvalue.id}" assignto="{!editid1}"/>
            <apex:param name="cid2" value="{!regvalue.id}" assignto="{!editid2}"/>
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public String editid1 {get;set;}
  public String editid2 {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  Â
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT Id,Name, Check_In_Date__c, Check_Out_Date__c, Hotel_Commands__c FROM Hotels__r),
         (SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    system.debug('editfunction inside===>'+editid1);
    system.debug('editfunction inside===>'+editid2);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c
       FROM Registration1__c where id=:editid];
    Â
    Â
    List<Hotel__c> hotel2=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid1];
    List<AirTravel__c> air2=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid2];
    Â
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    Â
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    List<Hotel__c> hotel1=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid1];
    List<AirTravel__c> air1=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid2];
    Â
    delete reg2;
    delete hotel1;
    delete air1;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        Â
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
      reg1 = new Registration1__c();
      hotel = new Hotel__c();
      air = new AirTravel__c();
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
how to showing the all values in my record can anyone helpme
- Manoprabha Palpandian
- July 23, 2021
- Like
- 0
my coding is running if i click the edit button showing an error
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  Â
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT id,name FROM Hotels__r),
         (SELECT id,name FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c
       FROM Registration1__c where id=:editid];
    hotel=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid];
    air=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid];
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    List<Hotel__c> hotel1=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid];
    List<AirTravel__c> air1=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid];
    Â
    delete reg2;
    delete hotel1;
    delete air1;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        //reg1 = new Registration1__c();
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="HoTel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column value="{!c.Name}"/>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column value="{!d.Name}"/>
        </apex:repeat>
        Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            Â
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            Â
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
ERROR IS:Â
List has no rows for assignment to SObject
Error is in expression '{!editfunction}' in page registrationnew: Class.Registrationcontroller.editfunction: line 23, column 1
An unexpected error has occurred. Your development organization has been notified.
WHAT IS THE MISTAKE IN MY code editfunction() method
please anyone helpme
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Hotel__c hotel {get;set;}
  public AirTravel__c air {get;set;}
  Â
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
    hotel = new Hotel__c();
    air = new AirTravel__c();
  }
  public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT id,name FROM Hotels__r),
         (SELECT id,name FROM AirTravels__r) FROM Registration1__c];
    return listreg;
  }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id,Name, FirstName__c, LastName__c, Email__c
       FROM Registration1__c where id=:editid];
    hotel=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid];
    air=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid];
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c
                   FROM Registration1__c where id=:editid];
    List<Hotel__c> hotel1=[SELECT Id,Name, Check_Out_Date__c, Check_In_Date__c, Hotel_Commands__c FROM Hotel__c where id=:editid];
    List<AirTravel__c> air1=[SELECT Id,Name, Arrival__c, Departure__c, Air_Commands__c FROM AirTravel__c where id=:editid];
    Â
    delete reg2;
    delete hotel1;
    delete air1;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  Â
  Â
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        //reg1 = new Registration1__c();
        if(hotel != null)
        {
          hotel.Registration1__c = reg1.id;
          upsert hotel;
        }
        if(air != null)
        {
          air.Registration1__c = reg1.id;
          upsert air;
        }
        Â
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock id="pg1" >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
        <apex:inputField label="HoTel Commands" value="{!hotel.Hotel_Commands__c}"/>
        <apex:inputField label="Air Commands" value="{!air.Air_Commands__c}"/>
        <apex:inputField label="CheckInDate" value="{!hotel.Check_In_Date__c}"/>
        <apex:inputField label="CheckOutDate" value="{!hotel.Check_Out_Date__c}"/>
        <apex:inputField label="Arrival" value="{!air.Arrival__c}"/>
        <apex:inputField label="Departure" value="{!air.Departure__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
        Â
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        <apex:repeat value="{!regvalue.Hotels__r}" var="c">
          <apex:column value="{!c.Name}"/>
        </apex:repeat>
        <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
          <apex:column value="{!d.Name}"/>
        </apex:repeat>
        Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            Â
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
            Â
          </apex:commandLink>Â
        </apex:column>
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
ERROR IS:Â
List has no rows for assignment to SObject
Error is in expression '{!editfunction}' in page registrationnew: Class.Registrationcontroller.editfunction: line 23, column 1
An unexpected error has occurred. Your development organization has been notified.
WHAT IS THE MISTAKE IN MY code editfunction() method
please anyone helpme
- Manoprabha Palpandian
- July 09, 2021
- Like
- 0
Can anyone helpme i have two child objects that are connected in one parent object how to save the record after the parent reccord savedd
public class Registrationcontroller {
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
   }
   public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT id,name FROM Hotels__r),
         (SELECT id,name FROM AirTravels__r) FROM Registration1__c];
    return listreg;
   }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id, Name, FirstName__c, LastName__c, Email__c FROM Registration1__c where id=:editid];
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c FROM Registration1__c where id=:editid];
    Â
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        reg1 = new Registration1__c();
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        Â
          <apex:repeat value="{!regvalue.Hotels__r}" var="c">
            <apex:column value="{!c.Name}"/>
          </apex:repeat>
          <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
            <apex:column value="{!d.Name}"/>
          </apex:repeat>
       Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>  Â
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
I am new for coding please help me
Custom Object - AirTravel, Fields - Arrival and Departure Datatype- Picklist. Custom Object - Hotel, Fields - Check In Date and Check Out Date Datatype- Picklist. These two custom objects lookup with Registraton1__c. How to give Hotels and Airtravel lookupvalues in reagistration1__c
  public Registration1__c reg1 {get;set;}
  public String editid {get;set;}
  public Registrationcontroller()
  {
    reg1 = new Registration1__c();
   }
   public List<Registration1__c> getregisterlist(){
    List<Registration1__c> listreg= new List<Registration1__c>();
    listreg=[SELECT Id, Name, FirstName__c, LastName__c, Email__c, (SELECT id,name FROM Hotels__r),
         (SELECT id,name FROM AirTravels__r) FROM Registration1__c];
    return listreg;
   }
  public void editfunction() {
    system.debug('editfunction inside===>'+editid);
    reg1=[SELECT Id, Name, FirstName__c, LastName__c, Email__c FROM Registration1__c where id=:editid];
  }
  public void deletefunction() {
    system.debug('editfunction inside===>'+editid);
    List<Registration1__c>  reg2=[SELECT Id, Name, FirstName__c, LastName__c, Email__c FROM Registration1__c where id=:editid];
    Â
    delete reg2;
    ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record deleted successfully'));
  }
  public void saveaction()
  {
    system.debug('saveaction inside===>'+reg1);
    try{
      upsert reg1;
      if(reg1.Id !=null){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Record saved successfully'));
        reg1 = new Registration1__c();
      } else
      {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Record not saved'));Â
      }
    }
    Catch(Exception e) Â
    {
      System.debug(e.getMessage());
    }
  }
}
<apex:page controller="Registrationcontroller" id="theRepeat" sidebar="false" showHeader="true">
  <apex:form >
    <apex:pageBlock >
      <apex:messages />
      <apex:pageBlockSection columns="1" >
        <apex:inputField label="FirstName" value="{!reg1.FirstName__c}"/>
        <apex:inputField label="LastName" value="{!reg1.LastName__c}"/>
        <apex:inputField label="Email" value="{!reg1.Email__c}"/>
      </apex:pageBlockSection>
      <apex:pageBlockButtons >
        <apex:commandButton value="save" action="{!saveaction}" rerender="pg1,theTable" />
      </apex:pageBlockButtons>Â
    </apex:pageBlock>
    <apex:pageBlock >
      <apex:dataTable value="{!registerlist}" var="regvalue" id="theTable" width="100%">
        <apex:facet name="caption">Registration List</apex:facet>
        <apex:column headerValue="Reg ID"><apex:outputText value="{!regvalue.Name}" /> </apex:column>
        <apex:column headerValue="FirstName"><apex:outputText value="{!regvalue.FirstName__c}" /> </apex:column>
        <apex:column headerValue="LastName"><apex:outputText value="{!regvalue.LastName__c}" /> </apex:column>
        <apex:column headerValue="Email"><apex:outputText value="{!regvalue.Email__c}" /> </apex:column>
        Â
          <apex:repeat value="{!regvalue.Hotels__r}" var="c">
            <apex:column value="{!c.Name}"/>
          </apex:repeat>
          <apex:repeat value="{!regvalue.AirTravels__r}" var="d">
            <apex:column value="{!d.Name}"/>
          </apex:repeat>
       Â
        <apex:column >
          <apex:commandLink value="Edit" action="{!editfunction}" rerender="pg1">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink> ||Â
          <apex:commandLink value="Delete" action="{!deletefunction}" rerender="pg1,theTable">
            <apex:param name="cid" value="{!regvalue.id}" assignto="{!editid}"/>
          </apex:commandLink>Â
        </apex:column>  Â
      </apex:dataTable>
    </apex:pageBlock>
  </apex:form>     Â
</apex:page>
I am new for coding please help me
Custom Object - AirTravel, Fields - Arrival and Departure Datatype- Picklist. Custom Object - Hotel, Fields - Check In Date and Check Out Date Datatype- Picklist. These two custom objects lookup with Registraton1__c. How to give Hotels and Airtravel lookupvalues in reagistration1__c
- Manoprabha Palpandian
- July 08, 2021
- Like
- 0
- Manoprabha Palpandian
- July 07, 2021
- Like
- 0