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

Iteration using another component

I want to use a child component for each record and iterate over it on the main component.  For some reason, the values don't show when I try to use this approach.

If I simply iterate and use the recordEditForm it works fine.  However, once I try to use the second component the values do not show.  Here is my iteration from the primary component:
 
<aura:iteration var="groupstructure" items="{!v.newGroupStructures}">
                  <c:GSCloneRecord groupstructure="{!groupstructure}"/>
            </aura:iteration>

Here is the GSCloneRecord Component.  I am unsure of  how to reference the values in teh groupstructure attribute.  I tried adding value= but that did not seem to work.  Any help would be greatly appreciated!!! thanks!!!!
 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,lightning:isUrlAddressable" controller="GSController">
    <aura:attribute name="groupstructure" type="Group_Structure__c" />
	<!-- Handle component initialization in a client-side controller -->
	<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

    <lightning:recordEditForm
             
            objectApiName="Group_Structure__c">
            <!-- the messages component is for error messages -->
            <lightning:messages />
  <lightning:layout multipleRows="true" verticalAlign="center" >
      <lightning:layoutItem size="1" padding="around-Small" >
 						<lightning:inputField aura:id="Name" fieldName="Name"   />
      				</lightning:layoutItem>

      
      
      <lightning:layoutItem size="1" padding="around-Small" >
 		<lightning:inputField fieldName="Status__c"/>
      </lightning:layoutItem>
      
     <lightning:layoutItem size="2" padding="around-Small">
        <lightning:inputField fieldName="Funding_Type__c"/>
     </lightning:layoutItem>
      <lightning:layoutItem size="1" padding="around-Small" class="customRequired">
    <lightning:inputField fieldName="Group_Number__c"/>
     </lightning:layoutItem>
    <lightning:layoutItem size="1" padding="around-Small" class="customRequired">
    <lightning:inputField fieldName="Section_Code__c"/>
     </lightning:layoutItem>
      <lightning:layoutItem size="1" padding="around-Small" class="customRequired">
       <div class="LSELabel">
        <lightning:inputField fieldName="Package_Code__c" />
      </div>
    </lightning:layoutItem>
    <lightning:layoutItem size="2" padding="around-Small" class="customDates">
        <lightning:inputField fieldName="Effective_Date__c"/>
    </lightning:layoutItem>
    <lightning:layoutItem size="2" padding="around-Small" class="customDates">
        <lightning:inputField fieldName="End_Date__c"/>
    </lightning:layoutItem>
      <lightning:layoutItem size="1" padding="around-Small" class="customProds">
        <lightning:inputField fieldName="Health_Product__c"/>
    </lightning:layoutItem>
    <lightning:layoutItem size=".5" padding="around-Small" class="customProds">
        <lightning:inputField fieldName="Prescription__c" />
    </lightning:layoutItem>
    <lightning:layoutItem size=".5" padding="around-Small" class="customProds">
      <lightning:inputField fieldName="Dental__c"/>
    </lightning:layoutItem>
    <lightning:layoutItem size=".5" padding="around-Small" class="customProds">
      <lightning:inputField fieldName="Vision__c"/>
    </lightning:layoutItem>
    <lightning:layoutItem size="1" padding="around-Small" class="customProds">
      <lightning:inputField fieldName="CDH_Status__c"/>
    </lightning:layoutItem>
    <lightning:layoutItem size="1" padding="around-Small" class="customRating">
      <lightning:inputField fieldName="Rating_Category__c"/>
    </lightning:layoutItem>
    <lightning:layoutItem size="3" padding="around-Small" class="customRating">
      <lightning:inputField fieldName="Coverage_Categories__c"/>
    </lightning:layoutItem>
    <lightning:layoutItem size="1" padding="around-Small">
      <lightning:inputField fieldName="Prefix__c"/>
    </lightning:layoutItem>
      <lightning:layoutItem size="5" padding="around-Small">
        <lightning:inputField fieldName="Description__c"/>
    </lightning:layoutItem>
        </lightning:layout>
        </lightning:recordEditForm>

</aura:component>



 
Best Answer chosen by Fred13
Thomas D.Thomas D.
Hey,

If the values are part of the record then you can simply pass recordId to the lightning:recordEditForm.
Like so:
<lightning:recordEditForm
            recordId="{!v.groupstructure.Id}" 
            objectApiName="Group_Structure__c">
That will make recordEditForm load your specified record from your groupstructure. Hope this helps.

All Answers

Thomas D.Thomas D.
Hey,

If the values are part of the record then you can simply pass recordId to the lightning:recordEditForm.
Like so:
<lightning:recordEditForm
            recordId="{!v.groupstructure.Id}" 
            objectApiName="Group_Structure__c">
That will make recordEditForm load your specified record from your groupstructure. Hope this helps.
This was selected as the best answer
Fred13Fred13
Thanks for responding!!!!  So does that mean the groupstructure attribute gets populated from the main component?

thanks again!!
Fred13Fred13
Got it!   Thank you!!!!!