Questions tagged [array]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
36 views

LWC: add new values to existing array

I have a multi select lookup component allowing users to select multiple accounts. My issue is that I am unable to add more accounts to the existing list Let's say I have 2 existing accounts on my ...
user avatar
0 votes
1 answer
40 views

How to set missing elements from the result in LWC

If the following array is the result from the database as input to datatable in LWC. How can I set empty/missing elements which are empty (fields are optional)? Datatable is showing as empty because ...
user avatar
1 vote
1 answer
39 views

Array keep empty after push object from forEach

I am calling one helper method from another helper method using Promise to wait for the result. I have problem where JsonArray array is empty after pushing object from forEach. Did I miss something? ...
user avatar
  • 13
1 vote
1 answer
36 views

Datorama array size after the use of SPLIT

On Datorama when trying to get the length of an array I'm able to get it using a calculated dimension by: a = SPLIT([Media_Buy_Name],'_') return EXTRACT(a[a.length-1],'&',0) But when using the ...
user avatar
2 votes
2 answers
56 views

LWC - Issue pushing value into the array

I'm having an issue with adding value into the array. This is lightning-checkbox-group with one additional "None of the above" checkbox to the end. Forget the option #1, 2 and 3 but trying ...
user avatar
  • 93
0 votes
2 answers
33 views

How to push urls to an array in Lightning Web Component

Im trying to make an LWC that shows a list of contact tiles that have their own url to navigate to the contact record page. I cannot seem to get the url to push into the array in the .then method. ...
user avatar
  • 41
0 votes
1 answer
235 views

How to sum up input field value inside iterative Table in LWC?

I have an iterative table contains input field onchange event i need to sum up the value of the iterative input box ? <table aria-describedby="conatact-list" class="slds-table slds-...
user avatar
0 votes
1 answer
104 views

How to get @api property value from parent to child in LWC?

I am trying to pass value from parent LWC component to child LWC component api property, but i am getting TypeError: Cannot read properties of undefined (reading 'Id') ? Parent.html <c-child total-...
user avatar
-1 votes
1 answer
45 views

Update a JSON array on change

I am trying to update a JSON array on change of a value. I am able to find the position where we need to change but when I try to change the element value it shows a sorry interruption popup box. Does ...
user avatar
  • 3,651
0 votes
2 answers
47 views

Apply CSS on lightning:button based on array of indexes

I have a group of lightning:button icons on my aura component inside a data table. I want to apply a custom css on some of them based on the array of indexes i have. Below is my lightning:button code. ...
user avatar
-2 votes
1 answer
87 views

LWC Array appears to be populated successfully, but the console.log() shows 'undefined' for values of a specific index in the array

I have an Apex method that returns to JS an inner class object(which is just an object of 3 fields). When assigning that inner class array to a variable in JS, it appears to be successful. Referencing ...
user avatar
0 votes
1 answer
304 views

Compare Array of objects in LWC

I have my old results in result1 and updated values in result2 . If both ids from the 2 arrays are same then i want to change the new value from result2 in result1 var result1 = [ {id:1, name:'...
user avatar
  • 29
0 votes
1 answer
60 views

Pardot CustomField array - not being updated by x-www-form-urlencoded POST API

I have a Prospect object in Pardot containing the following multi-select field: "Your_Interests": { "value": [ "Option1", ...
user avatar
0 votes
0 answers
15 views

How to use PHP array in Apex for API callout [duplicate]

I am trying to access an API through Apex, but the API documention shows the credentials being sent in a PHP array or a C#/VB.Net Byte array. The sample PHP code provided in the documentation shows ...
user avatar
  • 1
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=...
user avatar
0 votes
1 answer
430 views

Convert string to list of String in Apex

I have string value : String x = '(My, Test Value, New Other, Value)'; Expected outcome or expected list of string is : list<string> NewList = new list<string>{'My, Test Value','New Other,...
user avatar
0 votes
2 answers
705 views

Unable to pass an array from parent LWC to child LWC setter method

Trying to pass a array value from parent component to child component using setter method in child LWC but empty value is being passed to child setter method. I am Using parent LWC as a quick action. ...
user avatar
0 votes
1 answer
124 views

Add JSON to array does not work in wire adapter

Here is a link to the code I have working: https://codepen.io/reuel3/pen/EMEGQy It works as expected there. I get an error message when attempting same thing in wire adapter function: [LWC component's ...
user avatar
  • 441
1 vote
1 answer
378 views

Update Nested Array Object passed from Parent to Child in LWC

I have the below array which is being passed from other component. var myArray = [ { "Sequence": 1, "Value": 1, "sections": [ { ...
user avatar
0 votes
2 answers
388 views

Javascript error on push function LWC

I am getting below error: when I am trying to use push (function) to add array in another array. Javascript code : export default class CarDisplay extends LightningElement { @track carvalue; ...
user avatar
0 votes
1 answer
46 views

mapping a new array of objects results in undefined

I'm using this method: processPromotions(){ let promotionWithItem; this.allPromotions = this.sellerPromotions.map(promotion =>{ promotionWithItem = this.findPromotion(promotion, ...
user avatar
0 votes
0 answers
44 views

Iterating through a List and create another list

I'm trying to iterate through a list and create multiple records with it but I am not able to. The list is created and filled with the changeHandler event: if(event.target.name==='psProduct'){ ...
user avatar
  • 73
0 votes
1 answer
162 views

Update value in Array

I have an array and I present the records using a template with for:each. How can I update the array values based on user input so that when I call the apex to insert, the updated values get passed? ...
user avatar
  • 329
-4 votes
2 answers
349 views

JSON array into map with duplicate values [closed]

Final result when i tried the below code.
user avatar
-1 votes
1 answer
5k views

Adding a new key value pair in the JSON array [duplicate]

Hi I have a requirement in which i need to add a new key value pair in the JSON response, with the help of the for loop, kindly help me out for this below is my JSON: [ { "asdf&...
user avatar
  • 1
0 votes
1 answer
295 views

filter out the particular complete set of object from an array in Lwc

I have incoming JSON object around 100 of records, I need to filter out about the particular category of object...for example if the cat is A then it should be added in my track property. below is my ...
user avatar
0 votes
1 answer
90 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,...
user avatar
  • 485
0 votes
1 answer
142 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 ...
user avatar
0 votes
2 answers
149 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-...
user avatar
0 votes
1 answer
131 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 ...
user avatar
  • 368
3 votes
1 answer
2k 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 ...
user avatar
  • 368
0 votes
3 answers
2k 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, ...
user avatar
1 vote
1 answer
170 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 ...
user avatar
1 vote
1 answer
3k 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 = []...
user avatar
0 votes
2 answers
3k 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....
user avatar
0 votes
1 answer
559 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 ...
user avatar
  • 368
0 votes
1 answer
132 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-...
user avatar
  • 1
0 votes
1 answer
17 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('...
user avatar
  • 497
0 votes
2 answers
6k 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. ({"...
user avatar
  • 624
1 vote
1 answer
923 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 ...
user avatar
-2 votes
1 answer
6k 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....
user avatar
0 votes
1 answer
1k 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 ...
user avatar
2 votes
1 answer
2k 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 ...
user avatar
0 votes
1 answer
103 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: ...
user avatar
  • 83
0 votes
1 answer
877 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 = ...
user avatar
  • 4,521
0 votes
1 answer
615 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: ...
user avatar
0 votes
0 answers
31 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 ...
user avatar
  • 165
1 vote
1 answer
293 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 ...
user avatar
  • 205
1 vote
1 answer
3k 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"), ...
user avatar
-1 votes
1 answer
43 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}, ...
user avatar