Questions tagged [iteration]
The iteration tag has no usage guidance.
100
questions
1
vote
1
answer
90
views
LWC Change iteration to color even indexes
I am trying to find how to change the row color of even rows so it alternates between odd and even indexes in my list of divs so odd would be a background of say white and the evens would be a ...
1
vote
0
answers
57
views
How can I append new data rows to an existing data extension with predefined properties and columns?
There is data-extension-row-update and data-extension-row-create, but nothing like
data-extension-row-append.
Say I have an existing data extension I retrieve via
import ET_Client
myClient = ...
0
votes
1
answer
37
views
How to access an list from a list which stores all the list names
List<string> lstStrng = new List<string>{'a','b'};
List<string> lstOfNames = new List<string>{'lstStrng'};
string name = lstOfNames[0];
System.debug(name[0]);
I am ...
0
votes
0
answers
62
views
Lightning help with Apex array sort for:each iteration
I have a tabset that is rendering article records. Does someone have a lightning example how I would create the index to set the tab title and the order?
HTML
<template>
<lightning-card title=...
1
vote
1
answer
2k
views
LWC: Refresh for:each loops when new Array item added
I have 2 LWC components and loop through data in the following structure
periods
period.stages
stage.details
Within stage.details I render a table/form for each detail. After the table/form I have an ...
1
vote
1
answer
388
views
LWC: Can a "<template for:each=" be used with an inner "<template for:each=" where the inner for-each gets its value using the key from the outer?
I was looking to do the following and I'm not sure if it's possible in LWC.
I have a list of records which I'd like to loop through in the UI. I also have a map of records where the key is the iD of ...
0
votes
1
answer
554
views
LWC Superbadge - unable to display boat tiles Uncaught (in promise) TypeError: Cannot set property 'nodeValue' of undefined [closed]
I'm working through the LWC superbadge. I have passed the first 5 challenges, and in order to get to the six, I'm looking at the page. I haven't yet started the sixth challenge, but am just trying to ...
10
votes
1
answer
263
views
Comparing Apex Loops and why Iterators are dramatically slower than for loops?
I decided to use iterators to work with collections in a functional style at some point in development, but immediately noticed a CPU time performance drawdown. So I decided to do a simple performance ...
1
vote
1
answer
941
views
Nested tables with different headers and data LWC for:each
I have a requirement to create a component that is essentially 2 tables, parent/child. The parent table is Subscriptions, and the child table is Subscription Products that are related to that ...
0
votes
1
answer
306
views
Lightning Iteration change <td> css
I'm trying to change the css of a specific column of a specific row in an iteration while i'm using the drag and drop API.
i have 2 tables, i drag an element of the first table in the second to ...
0
votes
1
answer
33
views
Not able to insert Parent Record and child record in the same Apex function
I have a function that have 2 List of Objects in parameters (Schedule__c recList and scheduleTable__c recList2). Once I insert the recList, I am looping through the ID and insert child records to it. ...
0
votes
1
answer
62
views
How to iterate through an array of input fields with the same name and insert the value in an array?
I have a template that iterates through an array called amountArray and creates input fields for the amounts. The input fields have the same name called fieldAmount. When I enter value, I know which ...
0
votes
1
answer
313
views
LWC - How to clear my input text fields when saving?
When saving a record, my input fields should is replaced with empty value (clear the text field) and I am having issue with the one within the iteration. I have 2 inputs that are not part of the ...
1
vote
1
answer
144
views
Get all the Ids that were inserted by Database.insert - without iterating each record
We are using the Database.Insert(leads, false);
We want only the the ids that where insert. We have a lot of leads to be checked if we use
for (Database.SaveResult result: results) {
if (result....
0
votes
0
answers
72
views
Align table rows and columns in two different Lightning Components (Parent-Child)
I am new to Lightning Components and I have 2 Lightning Components (parent-child) where Parent iterates records of the child component.
<lightning:card title="Energy Profiles">
...
0
votes
1
answer
388
views
Issue while saving the wrapper data through imperative way of LWC
I am trying to pass the listofWrapper-> (List) data to Apex method for DML operation.
I am not able to figure out how to get Outer loop index ("Oppindex") for any change in the child ...
0
votes
1
answer
868
views
LWC Nested Iteration Issue
I am facing an issue with the nested iteration,
Suppose I have one button in child loop and i want index of parent and child loop both in onclick function of JS file.
I am only getting index of child ...
0
votes
1
answer
57
views
Mirroring of single picklist value in all picklists in nested aura iteraton
I have used an aura iteration to create a table and I have a picklist field inside that table which uses an aura iteration itself. The problem here is that whenever I select the value of any one of ...
1
vote
2
answers
427
views
LWC for:each needs 3 levels, but SOQL query aggregate relationship limited to 2. What's your best practice?
so I have a structure like:
<template for:each={containers.data} for:item='container'>
<....> //container info
<template for:each={container.Pallets__r} for:item="pallet"&...
0
votes
0
answers
875
views
Iteration in LWC not working for 2nd element of input array
I am working in LWC requirements where I have a list of records using this list I need to create inputs text. Once I loop through the list in LWC 'HTML component' my input texts are coming as aspected ...
1
vote
1
answer
3k
views
LWC create input fields under LWC iteration
I am new to LWC. I have to create multiple input fields for different rows. Let say, I have selected 3 records from the previous page and for all those 3 records I need to create the input field and ...
1
vote
1
answer
485
views
Bulk Apex iterator not working with aggregate query
I am at a bit of a loss at how to properly structure a batch apex query with an iterator in order to utilize batch apex with an aggregate query.
This is my current code
Iterator
global class ...
0
votes
1
answer
35
views
capture value from drowndown in iteration
Newbie in SFA development, however I have experienced in ASP.NET (C#) development. I have a question regarding this output:
the NAME COLUMN is list of PRODUCT populated from the Salesforce Object. ...
0
votes
1
answer
258
views
Error handling for iterable child component inside parent in lightning web components (LWC)
In my parent component , I have used child component inside and iteration. So for example child component is present twice in parent component.
Now I want to show error message when on of the required ...
3
votes
1
answer
2k
views
How to use 'lightning-checkbox-group' in for:each loop?
Currently, my requirement is that I want a checkbox in front of names.You can see below screenshot.
So I used lightning-checkbox-group in iteration but it does not work.
Here is the Playground Link ...
5
votes
2
answers
11k
views
Expressions in for:each index value in LWC? [duplicate]
Currently, I am facing an issue is that I want index starting from value "1"
I am using for:each in my code.
<template>
<lightning-card title="HelloForEach" icon-name="custom:custom14"&...
0
votes
1
answer
4k
views
LWC: Iterate Map twice - Map<Integer, Map<String, String>>()
I broke my head with this case. Please help.
APEX
Map < Integer, Map < String, String >> reportData = new Map < Integer, Map < String, String >> ();
return reportData;
JS
...
2
votes
2
answers
2k
views
Iterating over wrapper class records lists in LWC
I have a LWC where i want to iterate over different lists of Opportunities in a wrapper.
Currently im using:
import { LightningElement,wire } from 'lwc';
import OppRecords from '@salesforce/apex/...
0
votes
1
answer
367
views
Using aura:iteration over lightning:outputField doesn't seem to work
I'd like to display a list of configured fields (names possibly stored in CMDT) with lightning:recordViewForm, so it's easy to add/remove fields without deploying the component. However aura:...
0
votes
1
answer
154
views
get a particular element in web component iteration
I want actually to be able to get an attribute on a particular item in the web component iteration, but cannot get it to work.
Look for instance the following code :
<template>
<...
0
votes
1
answer
109
views
Custom Iterators - calculating scope - batch
I am trying to understand the custom iterators topic Custom Iterators
But there is a thing which I don't get.
There is a next() method which divides the query size into smaller ones, am I right? In ...
0
votes
1
answer
51
views
Is Filling a Map iterating on a list, deepcloning it and clearing a best practise?
I'm trying to fill a Map < Id, List< sObject>> by looping other the Map.keySet(), filling the list of sObjects, affecting it, and then go to the next key.
I read somewhere that it was a good ...
0
votes
0
answers
126
views
What is the best way to populate a map from a list conditionally?
I would like to know if there's a better way to populate a map from a list where conditions apply as to whether the list item is to be added to the map or not.
For eg I have a list of objects ...
2
votes
2
answers
4k
views
LWC: detect last element in for:each iteration
I'm trying to output a list of strings separated by commas in LWC, such as:
cat, dog, mouse
I need to use template for:each and output a list item and a comma, but only if the item is not the last ...
1
vote
0
answers
102
views
aura:iteration label of current field
Is there a possibility to get the Label of current field using aura:iteration ?
<aura:iteration items="{!v.objectName}" var="objectName">
<lightning:input value="{!objectName.field1}" ...
1
vote
1
answer
50
views
How to Implement "fluent constructors" inside visualforce page data iterator?
I am trying to put together a custom controller class implementing the fluid interface builder pattern. Said class does compile, and my question is how can it be implemented inside a VisualForce page'...
1
vote
2
answers
664
views
Exception not being caught; System.FinalException: Cannot modify a collection while it is being iterated
Why is this Exception not being caught?
I read that System.LimitException is not caught but didn't see anywhere about System.FinalException.
Non-Working Code
@AuraEnabled
public static List<...
1
vote
0
answers
2k
views
Lightning button attribute "Disabled" in "aura:iteration tag"
I'm trying to enable a lightning:button if a lightning:inputField changes.
This is the aura:component:
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:...
1
vote
0
answers
72
views
how to check iterator in batch process
I am using an iterator to use an aggregate query on a custom object looking for unique years. on the very last iteration, I want to change a value, so I am hoping to use hasNext, but it looks like i ...
1
vote
2
answers
712
views
Passing List<WrapperClass> as a parameter from Visualforce to Lightning and to iterate over the List<WrapperClass>
This is my VF code, which runs on onclick
<script>
function func(data)
{
$Lightning.use("c:testingFromVFtoLightningApp", function(){
$Lightning.createComponent("c:...
1
vote
1
answer
1k
views
How to iterate sub query on lightning page
I want to display the contact names and opportunity names where AccountID is not null, I am able to display the contact names, can someone please help me to display the opportunity names too?
Below ...
2
votes
1
answer
631
views
Iterate related records, display images from string name of contentAsset in Community Cloud
I'm very new to Salesforce, so my apologies if my approach is all wrong.
I want to display a list of buttons with images using a lightening component in Community Cloud. The list comes from records ...
1
vote
1
answer
45
views
List iteration - item with space
I am trying to create a very basic static list to iterate through. One of the values has a space in it. I can't figure out how to add the item to the list with a space. In the example below, I can'...
0
votes
1
answer
57
views
How to make varaible of items in a iteration in a lightning component
I have an iteration which reproduces a list on a lightning page. I want to make this iteration variable based on 2 lists. How do I make the list (items) variable based on IF condition? Or do I need to ...
0
votes
1
answer
405
views
iterating a multidimensional List
I am trying to recieve a email with an attachment (CSV FIle) and have it iterate through the csv and upsert it as records in a custom object. i upload the document by hand daily. PAIN!
i am using a ...
0
votes
2
answers
4k
views
how to use wrapper class in batch iterator (using custom iterator)?
So I trying to use list of wrapper class as iterator in batch. below is the code I have tried so far
Iterable class
public class AccountCustomIterator implements Iterable<AccountWrapper>, ...
2
votes
1
answer
9k
views
Lightning Components: How to do nested aura:iteration of a list of Accounts with subselected Contacts?
Scenario
In Visualforce we had strong patterns for implementing the rendering of hierarchical structures. As a simplified example (standing for many other use cases) let's say we want to show all ...
4
votes
1
answer
12k
views
Inserting Records using a lightning component
I am looking to make a lightning component to insert my Transaction__c object records against all relevant Contracts pulled back requiring action. As it stands I am returning all of relevant contracts/...
1
vote
2
answers
694
views
Add records incrementing based on known Date
I expect this has been described before but have been unable to find it.
I am entering OpportunityLineItemSchedule in Apex and would like wipe out the default ones, which are created based on Close ...
4
votes
1
answer
1k
views
Lightning Aura Iteration ReRender
I am trying to rerender an iteration(wrapper) when an input field is changed although I am extremely unfamiliar with Lightning. Everything that I've read it "it should just work", which I don't ...