Questions tagged [array]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
45 views

for loop pulling through Array in to table

I'm trying to build a loop that goes through a field that contains multiple labels and values, the outputs are not correct and I can't figure out why. can anyone help? %%[ SET @str = "label:a,...
0
votes
1answer
35 views

How to increase the list size on button click on lightning component?

Below is my code .please do let me know how to increase the size of the list on my component on button click? Right now it is replacing the previous value . I want to add the new value to the existing ...
0
votes
2answers
35 views

REST API remove contact from journey

I'm using this REST API JSON call to remove a subscriber from a journey: [ { "ContactKey": "0031xxxxxxxxxxxxxx", "DefinitionKey": "cexxxxxx-b20f-74ea-c67a-...
0
votes
1answer
22 views

When removing from array the wrong child component is removed

Sorry I wasn't sure how to phrase the title of this question. I have a parent component which populates an array cartItems populated with objects. For each object in the cartItems array a new ...
3
votes
1answer
44 views

Lightning Web Component Error: ['set' on proxy: trap returned falsish for property '0']

I am trying to build a cart where I add products to it and can then remove them. However on remove I receive the error ['set' on proxy: trap returned falsish for property '0']. In my component ...
0
votes
2answers
48 views

How to parse json response with multiple records and add it to list

I have a json response from third party system which is as below. { "returnCode": 600, "lineItems": [ { "id": 9762, ...
1
vote
1answer
38 views

Nested array/for loop

The code below is working so far. Now I added two fields to the visualforce page (selected_year_1 selected_year_2) where the user can select a year (2016/2017/2018...) for both fields. This years ...
1
vote
1answer
321 views

How to pass a mutable Array from Parent Component to Child Component in LWC

I want to pass an Array of Objects from a parent to child component. The child component will modify this array (but not perform a DML). This is what i tried somewhere in parent.js @track tempList = []...
0
votes
2answers
87 views

LWC JavaScript: Can't Add a Property to Objects While Looping through an Array of Those Objects

I'm trying to loop through an array of objects and add a property to each that meets certain criteria. Here's the snippet: onRecordEditFormLoad(event) { let tempFieldWrapperArray = this....
0
votes
1answer
49 views

Error: Invalid mutation: Cannot set [value] on [array]. [array] is read-only

I have lightning playground where I have an array and for each item in the array a simple component with a remove button displays. When you click the remove button the component should no longer ...
0
votes
1answer
42 views

Array Clear out in Javascript Lightning Web Component

In an Array multiple values(List) are coming and i need to clear out the particular list on the basis of a boolean value For example In Child Component two values are getting passed as below: <c-...
0
votes
1answer
12 views

Javascript filering not working when used with string of array

0 I am trying to filter a javascript array (json array) with the string array, and set it back in itself. I am using this code` var statusFilters = component.get("v.statusFilters"); console.log('...
0
votes
2answers
474 views

How to pass array to apex method in LWC

I am creating custom functionality of Adding opportunityLineItem in LWC. Once I input details and click 'Save' I am not able to pass string value or object value to Apex method. Throwing error. ({"...
1
vote
1answer
43 views

How to push data to a nested Object

I have table which has I'm iterating the Above Response to display the data in Table Format. Column 1 has Iteration Value Of timeSheetDate, Column 2 has nested data object as a fields. In column 2 ...
-2
votes
1answer
422 views

how to Create array in LWC [closed]

Can you Please help me how to Create array in LWC @track arraydata = []; let rtValues = Object.values(this.studentsData); for (let i = 0; i < rtValues.length; i++) { this....
0
votes
1answer
292 views

Record is not getting deleted from datatable in LWC

I am trying to delete a record based on the row selection in data table in LWC. So when a row is selected, the record Id is pushed to the array selectedIdsArray but I am trying to pass it to the Apex ...
2
votes
1answer
296 views

Unable to update tracked array in LWC

For some reason, the push in the code block below is not updating the array. The console.log statement displays the array with 0 elements. I created a local array variable and pushed to it with no ...
0
votes
1answer
23 views

Building out a multi-dimensional array / list for an update statement

I have a contact list I am looping over and one of the fields in the contact object holds 1 or more contactIDs in a delimited list using a carriage return. Standard Contact Object: ContactId: ...
0
votes
1answer
85 views

In JS of LWC, line after forEach statement does not execute

I have below Javascript function in lwc apexJobInfoData; @track isBatch; getData({ error, data }) { if (error) { // TODO: handle error } else if (data) { this.jobId = ...
0
votes
1answer
105 views

Why cant I print out my array of objects in SSJS

I am trying to prepare a list of objects that I am pushing to another service, I have generated a list of objects that need to be sent. For some reason I cannot stringify the array. This is my code: ...
0
votes
0answers
27 views

How to handle both a single item and an array for the same property [duplicate]

I have an incoming JSON payload that with the parameter device_config. This parameter might be, at times, sent as an array of strings or a string. How would I handle this parameter when its being sent ...
1
vote
1answer
154 views

Binding array nested in a map to a lightning input component not working as expected

I have a component attribute which is as follows: <aura:attribute name="variants" type="Map" default="{names: ['Tom', 'Dick', Harry']}" /> The array in the map is used in lightning input ...
1
vote
1answer
357 views

Aura Component Lists and Javascript Arrays

I've recently noticed that if I set an aura:attribute of type "List" from a Javascript array, then later retrieve that same attribute value via component.get("v.myListAttribute"), the return value is ...
-1
votes
1answer
40 views

calculate the total of a variable based on another variable in JS controller lightning

finalMap=[{"key":"OTC","subprocessName":"CXO","weightage":50}, {"key":"OTC","subprocessName":"Order Management","weightage":50}, {"key":"RTR","subprocessName":"Fixed Asset Accounting","weightage":20}, ...
-2
votes
1answer
112 views

Convert string representation of array to Apex Array

*Edited to correct JSON string I have a string which looks like: "[[[1,2],[3,4],[5,6]]]" I need to convert it to Apex array like: [[[1,2],[3,4],[5,6]]] Using JavaScript I am able to simply pass ...
2
votes
1answer
1k views

How to add a string value to string array lightning component

I am fetching some recordtype values as a string array. I want to add the string -- None-- to the array so its obvious nothing is selected by default. How do I achieve this. I tried the following but ...
0
votes
2answers
230 views

apex add list to list

I have this code: String cantidad; String total; List<List<String>> pList = new List<List<String>>(); List<String> lstStr = new List<String>(); List<...
0
votes
1answer
190 views

Unable to read Array from Postman app into Email

I am trying to read the array values from API payload which i am testing via POSTMAN app and content-type is application/json. I am able to capture the values of all the rest attributes defined in my ...
5
votes
1answer
940 views

Array.push() on a @tracked array doesn't cause component refresh in lightning-accordion in LWC

This may be a duplicate of Array.push() won't update Lightning Web Component View However, that is for an @wire case, while this is for lightning-accordion. I am attempting to use the lightning-...
0
votes
1answer
87 views

Updating an array in controller to store user input from Visualforce page

I need to store input from user in controller so it can be used for calculations. To do this I am using an array, to get input in the controller. But getting issue: Subscript is invalid because list ...
0
votes
1answer
33 views

How to create a bidimensional array of Strings and acces it

I'm building a trigger that everytime a Campaign Member is added , Salesforce sends an email to the Owner of the Account where the Contact Lives that a Campaign Member is added. Due to Salesforce ...
0
votes
1answer
149 views

how to ignore comma in string array in apex

I have this String Array [Burlington Textiles Weaving Plant Generator,Tim,Barr,"1,056.00",Burlington Textiles Corp of America]; How can I Ignore that Amount comma inside the " " .
7
votes
1answer
7k views

Array.push() won't update Lightning Web Component View [duplicate]

We are migrating over to Lightning Web Components in the last couple of weeks now and we had some struggles with the arrays in Javascript. On a trackable array, when I call push in a wiredMethod, ...
1
vote
1answer
3k views

Lightning web component object reference

I've seen many examples with primitive data types, but I've been trying to propagate array down to my children component and encountered some problems. My parent component looks like this: <...
0
votes
2answers
157 views

Adding an element in object JavaScript

My Question is am displaying the records in Table format and there is a NEW button when it's pressed want to create a new row at the top. With all the fields empty. Here doc contains the record ...
-4
votes
2answers
84 views

how to sort array values in desending order based on numbers [closed]

Please help me to sort this values in dessending order Iam getting related version in below array: for(var j=0;j<prodVersions.length;j++) { component.set("v.prodVersion",...
2
votes
3answers
894 views

How to pass dynamic arrays in Lightning

I'm not able to pass a dynamic string array into a component without using java script. Example: values="{!v.foo + ',bar'}". In this example, the (expected) array seems to be passed as a String. I ...
0
votes
2answers
1k views

Delete an array element using event.getSource().get(“v.name”)

I try to get index, but it's always -1. JS: close : function(component, event, helper) { let vacancies = component.get("v.vacancies"); //an array let vacancy = event.getSource().get("v.name"...
0
votes
1answer
65 views

Array with saving previous objects in Lightning

I need to make an array for iteration selected objs in future. But when I push needed element, it updates. It's because I always call a new var: var objs = []; How can I add the element right? My ...
0
votes
2answers
209 views

Get first index and last index for each ID

I want to calculate the user online time, from the API response, by taking the first and last login time.. I tried to parse the JSON and store it in array of strings.. Theres UserID, Start Time, End ...
1
vote
2answers
130 views

Help Interpret Advanced Array Work in Lightning JS

I didn't write but rather I'm reviewing the following Lightning JS function: InitializeComponent : function (component) { var recId = component.get("v.recordId"); var action = ...
3
votes
2answers
564 views

Lightning component attributes: Difference between Array and List

According to this document, the type type[] is "An array of items of a defined type" and the type List is "An ordered collection of items". I've tested the output of both structures (with integer ...
-1
votes
1answer
55 views

Convert string into array

i am getting following string from POST. i want to convert this string in to array. please help me how i can do this? [{Product Id=3423654000000343061, Discount=0.00, Line Tax=Sales Tax===0:::0;;;, ...
1
vote
1answer
1k views

how to get value from map when wrapper class is the key

I have a wrapper class of picklist values and labels. I am creating a map with picklistValues and List as key and value types. Now, I am getting an error won this line -- objResults.get(...
0
votes
1answer
80 views

How to add values on array object [closed]

How can I add values in an array from the same object. Sample structure of the array should be. CountryName: USA City : Florida, Texas, California CountryName: UK City: Scotland, Wales I want to ...
2
votes
1answer
572 views

How to pass a Javascript array to an Apex controller?

I have the following problem, I want to assign an array of javascript to a list of the apex controller. I have to update 3 list of the saleforce page with a "save" button and pass to the controller ...
0
votes
1answer
1k views

How ro pass an List/array from javascript controller to helper

I have the following attribute in my lightning component <aura:attribute name="serverList" type="Opleiding__c[]"/> I can call this in my javascript controller with var serverList = component....
1
vote
2answers
628 views

3 nested aura:iteration's don't work properly

I have the following object in Javascript: [{"Name" : myName, "Sub" : [{"Name": mySubname, "Items" : [{"Id": a, "Name": b},{"Id": c, "Name": d}, ...] }, {...}, ....
1
vote
1answer
2k views

Compare part of string in javascript lightning component

I have a List which is filtered by the comparison of the value of a picklist (for example A) and selected value of a checkbox (for example A) which works ok. I want to be able to compare a ...
0
votes
1answer
2k views

How to get value after serverside call javascript lightning component

I do a serverside call to get my accounts which returns my accounts. I want to be able to use the returned accounts as a variable to work with. How do I accomplish this. My returnvalue gives me an ...