Questions tagged [iteration]
The iteration tag has no usage guidance.
110
questions
0
votes
1
answer
50
views
Map value to specific variable in loop within Flows?
Working on a flow in which I need to iterate over up to 12 records and sort it in descending order by date. Then take a single value from each record and store it. I will then update the parent record ...
-3
votes
1
answer
62
views
How to get field API Name and Values from an array list to be iterated in the HTML
From the list below, I want to have column in html with FieldApiName(column1) and FieldValues(column2) in HTML.
How will I do that with the output list below. that accountIds can have different ...
1
vote
1
answer
147
views
LWC - How To Loop Through A List With data-aura-rendered-by attribute?
is there any way we can loop through a list of object with this code snippet?
It works okay when the list return 1 record. However, if the list has more than 1 record, it cannot rendered (display).
...
1
vote
1
answer
71
views
System.LimitException: Too many query rows: 50001 when Using AggregateResult interface in batch class?
I want to aggrgate Average of Quality Score of Account object based on User's Market and I want to those summary details in one of Custom Object.
I have written a batch class where I am using Iterator ...
6
votes
0
answers
87
views
Why can't a Queueable use an Iterator that comes from a Set?
I saw some surprising behaviour when storing the iterator obtained from a Set<Id> as a member in a Queueable class. So, I wrote the following trivial Queueable class to investigate:
public class ...
0
votes
2
answers
104
views
How can I add line breaks to horizontally iterated items?
I want to display keyboard keys in a way that's similar to standard QWERT keyboard's look. Therefore, I want to add line brakes after "P" and "L" letters. Any help is much ...
1
vote
0
answers
14
views
Avoid iterating over list inside loop [duplicate]
Hello guys I have two lists. One has contact records and other has ContentVersion records. What I need to do is that by every contact I have to create a documents and attach to them by using the ...
1
vote
1
answer
111
views
Batch Class with Custom Iterator Not Using First Element?
I have been hitting my head against the wall with this one.
I have a batch class that runs against Leads, Contacts, and Accounts as well as 2 external objects. I created a CustomIterator to accomplish ...
0
votes
1
answer
845
views
Iterate over all fields of all FieldSet of an SObject
Just posting this because it took me a bit of time to get my answer. For anyone wanting to get a list of all the Fields present on all the FieldSets of an Object, here is my method.
Hope it will be ...
1
vote
0
answers
122
views
Aura Component Boxes in aura iteration
How could I have some boxes with same vertical size that are being created in a iteration on aura component?
Code:
<div class="slds-grid slds-wrap">
<aura:iteration ...
1
vote
1
answer
1k
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
348
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
160
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
82
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
5k
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
2
answers
6k
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
1k
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 ...
11
votes
1
answer
775
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
4k
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
717
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
87
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
571
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
1k
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
1k
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
220
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
749
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 ...
1
vote
1
answer
2k
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
128
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
641
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
1k
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 ...
2
votes
1
answer
6k
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
1k
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
38
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
396
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
3k
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
18k
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
5k
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
3k
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
483
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
402
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
284
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
52
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
259
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 ...
3
votes
2
answers
6k
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
132
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
101
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
870
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
128
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
902
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:...