You need to sign in to do that
Don't have an account?

I've a json and i'm using aura:iteration to display values in <tbody> but i don't want to show all the values in table
I want only one value from the json but i'm getting all the values how can i stop iteration or is there any way to show only one row like keeping size please help to find the solution
Thank you in Advance,
<tbody>
<aura:iteration items="{!v.jsonValues}" var="item" indexVar="rowIndex">
<tr data-data="{!rowIndex}">
<td role="gridcell" tabindex="-1" data-label="Record Type Name">
<span class="slds-grid slds-grid_align-spread">
<div class="slds-truncate">
<span class="slds-truncate">{!item.firstName}</span>
</div>
</span>
</td>
</tr>
</aura:iteration>
</tbody>
Original Output:-
Ramesh
Suresh
Rakesh
Expected Output:-
Ramesh
Thank you in Advance,
<tbody>
<aura:iteration items="{!v.jsonValues}" var="item" indexVar="rowIndex">
<tr data-data="{!rowIndex}">
<td role="gridcell" tabindex="-1" data-label="Record Type Name">
<span class="slds-grid slds-grid_align-spread">
<div class="slds-truncate">
<span class="slds-truncate">{!item.firstName}</span>
</div>
</span>
</td>
</tr>
</aura:iteration>
</tbody>
Original Output:-
Ramesh
Suresh
Rakesh
Expected Output:-
Ramesh
Please try the below any one of the way:
OR
Thanks,
Maharajan.C
All Answers
Please try the below any one of the way:
OR
Thanks,
Maharajan.C
Thanks for the reply i've got the solution and it is same as your second one which you have sent.
Thanks for the quick reply Thank you very much.
Maharajan.C
If you want only a single value then you don't need to iterate over it just simply create a new attribute and
store the required JSON value into it and simply print on UI.
If you find your Solution then mark this as the best answer.
Thank you!
Regards
Suraj Tripathi
What if i have two json files i have to use aura if and match two values and show YES or else NO how it is possible can you explain if possible
Because i've tried the below code but it is not working and always displaying only else part
<aura:if isTrue="{!firstjson.firstName== '!secondjson.firstName'}" >
<td role="gridcell" tabindex="-1" data-label="Record Type Name">
<span class="slds-grid slds-grid_align-spread">
<div class="slds-truncate">
<span class="slds-truncate">Yes</span>
</div>
</span>
</td>
<aura:set attribute="else">
<td role="gridcell" tabindex="-1" data-label="Record Type Name">
<span class="slds-grid slds-grid_align-spread">
<div class="slds-truncate">
<span class="slds-truncate">No</span>
</div>
</span>
</td>
</aura:set>
</aura:if>
Thanks,
Maharajan.C
I've updated that aura:if which you have shared but it is also displaying only ELSE part if statement is not working