Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [iteration]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
186 views

LWC render logic resetting previous records

I am trying to have an LWC where the user can add rows and the new row will render fields based on the user selected value. I have 2 issues with my LWC After user selects first field picklist value ...
Phuc's user avatar
  • 347
4 votes
1 answer
134 views

Why can a Set be modified in an Apex loop but not a List?

Prelude According to Salesforce documentation, both Sets and Lists are considered Collections: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_collections.htm ...
Moonpie's user avatar
  • 2,654
0 votes
1 answer
352 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 ...
stormy's user avatar
  • 51
-3 votes
1 answer
171 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 ...
sFDev_newbie's user avatar
1 vote
1 answer
319 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). ...
Pam's user avatar
  • 107
1 vote
1 answer
93 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 ...
SFDCDJ's user avatar
  • 1,864
6 votes
0 answers
101 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 ...
Aidan's user avatar
  • 13.7k
0 votes
2 answers
216 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 ...
Akif's user avatar
  • 15
1 vote
0 answers
15 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 ...
TechGuy's user avatar
  • 97
1 vote
1 answer
214 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 ...
user7100889's user avatar
1 vote
1 answer
1k 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 ...
Alexis's user avatar
  • 129
1 vote
0 answers
138 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 ...
user115058's user avatar
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 ...
Bill Woodson's user avatar
1 vote
0 answers
401 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 = ...
Andreas L.'s user avatar
0 votes
1 answer
254 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 ...
Rahul Allada's user avatar
0 votes
0 answers
85 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=...
Rhonda Gutman's user avatar
1 vote
1 answer
6k 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 ...
RedQueries's user avatar
1 vote
2 answers
7k 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 ...
RedQueries's user avatar
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 ...
hgolov's user avatar
  • 773
11 votes
1 answer
949 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 ...
Oleh Berehovskyi's user avatar
1 vote
1 answer
5k 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 ...
Carryonplease's user avatar
0 votes
1 answer
765 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 ...
Fabien Braconnier's user avatar
0 votes
1 answer
103 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. ...
Eric's user avatar
  • 73
0 votes
1 answer
632 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 ...
Eric's user avatar
  • 73
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 ...
Eric's user avatar
  • 73
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....
Juan Jardim's user avatar
0 votes
0 answers
249 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"> ...
Kostas Karagiannis's user avatar
0 votes
1 answer
791 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 ...
Moni Jaiswal's user avatar
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 ...
Moni Jaiswal's user avatar
0 votes
1 answer
138 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 ...
Jigyansoo Das's user avatar
1 vote
2 answers
664 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"&...
Dextersecret's user avatar
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 ...
SFDC 44's user avatar
  • 664
2 votes
1 answer
7k 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 ...
SFDC 44's user avatar
  • 664
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 ...
Bobbygllh's user avatar
  • 731
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. ...
Akosi Jeff's user avatar
0 votes
1 answer
409 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 ...
Pankaj Andhale's user avatar
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 ...
Sahil Malhotra's user avatar
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"&...
Sahil Malhotra's user avatar
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 ...
Ivan S.'s user avatar
  • 349
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/...
Akshay_SFDC's user avatar
0 votes
1 answer
490 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:...
Bing's user avatar
  • 175
0 votes
1 answer
444 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> <...
vanessen's user avatar
  • 2,685
0 votes
1 answer
327 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 ...
Quicki's user avatar
  • 115
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 ...
Alexis MASSON's user avatar
0 votes
0 answers
308 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 ...
Irene's user avatar
  • 1,829
3 votes
2 answers
7k 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 ...
mmm321321's user avatar
  • 659
1 vote
0 answers
140 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}" ...
Quicki's user avatar
  • 115
1 vote
1 answer
108 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'...
AlexBraun's user avatar
1 vote
2 answers
933 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<...
shmuels's user avatar
  • 555
1 vote
0 answers
3k 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:...
Carlos Naranjo's user avatar