Questions tagged [array]
The array tag has no usage guidance.
136
questions
0
votes
1
answer
33
views
Array not rerendering
I can't get my array to rerender my lightning component. The boolean value rerenders fine. I've tried setting the data by direct assignment, using the spread syntax and as below, using map. What am I ...
0
votes
1
answer
56
views
Original Array changes when its copy is changed in LWC
So i have a method in my javascript, transformJson(input) which is returning a JSON.
The result returned is being used in another method as below:
handleFinalJson(){
this.originalVar = this....
-3
votes
1
answer
66
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 ...
0
votes
2
answers
54
views
I have a checkbox toggle in my child component, in which I am sending my parameter from parent component. But it's unable to read in HTML
Variable value which I am sending from parent component is getting it's value in child component but it's not getting read in HTML. As, in HTML I'm reading it via for each loop because I am having 3 ...
0
votes
1
answer
64
views
Looping SSJS to output Ampscript variables partially works if I don't use a word building array function. Can't figure out why
I've got a data extension which has multiple rows for each item a user has in their cart and it's tied to their email address. The main issue is I need to cut off the product name at a max character ...
2
votes
1
answer
374
views
How to convert an Array of Strings to an Array of Objects in LWC?
I have an array which has following String values - ['WATER','ENERGY','PAPER','FOOD SAFETY','FOOD AND BEVERAGE', 'INSTITUIONAL','PEST']
Im trying to convert this into an array of objects with a key ...
1
vote
1
answer
193
views
Loop through specific field in Array
I am looping through an array but it is looping through each field of the record. So the record has 4 fields so its looping 4 times for each record. I need all of the fields because I will use them ...
0
votes
1
answer
130
views
Remove duplicates from an array built in SSJS
I'm using SSJS to pull api data and build emails. I have an array built that has some duplicate data in it. I'm looking for anyway to remove the duplicate information. I've tried all the regular JS ...
1
vote
2
answers
936
views
Convert array of objects to an object in javascript
I have an array of objects with below value
var arr =
[{"Id":"0QL8W000006RHl1WAG","Sortorder":"1"},
{"Id":"0QL8W000006RHl0WAG",&...
3
votes
1
answer
251
views
Reactive array of objects and "Use Lightning Web Security for Lightning Web Components"
I have a component that iterates through a property that is an array of objects.
<template>
<template for:each={widgets} for:item="widget">
<p key="widget.name"...
0
votes
0
answers
44
views
array javascript
I have the following nested array than i want to display in a Aura datatable ListOne (and ListinnerOne), ListTwo and ListThree, I'm trying to extract each list but I'm facing to this dificulty to ...
-1
votes
1
answer
1k
views
Replace String inside json inside Array Javascript
Hello guys I have a js file that has a list of json that have the next structure:
[{"label":"9312 - Item1", "value":"9312"},
{"label":"9313 -...
1
vote
0
answers
321
views
Unable to access array within an array from Salesforce flow http callout (beta)
In sandbox, I am attempting to gather the information from https://data.nasdaq.com/api/v3/datasets/USTREASURY/YIELD.json
I used the beta feature of creating an HTTP callout right from the flow. It ...
1
vote
1
answer
295
views
LightningModal extract first Element from Array to use in String
On my Parent Lightning Element I have a data table where on Row Selection I want to open a custom Record Page in a Lightning Modal. I am struggling to extract the Id I am passing in the options array.
...
1
vote
1
answer
154
views
Apex not Serializing the Entire Object
I'm running into a very odd issue and hoping someone else has also experienced this.
I'm trying to build an object to send to an application called Processmaker and it requires very a specific object ...
0
votes
1
answer
2k
views
displaying js object array values in lwc
Having trouble displaying true values in lwc html
This is the js:
import { LightningElement, api, track, wire } from "lwc";
import retrieveQuoteData from "@salesforce/apex/...
2
votes
1
answer
112
views
How to reduce array and add related integers together
i have this array
const input = [
{ StockKeepingUnit: 'SKU-001', Quantity: 3 },
{ StockKeepingUnit: 'SU-002', Quantity: 5 },
{ StockKeepingUnit: 'SU-002', Quantity: 7 },
{ StockKeepingUnit: '...
-1
votes
1
answer
41
views
How to consolidate arrays into 1
Ive been working on consolidating large amounts of data and i have gotten the array to this point.
[{"StockKeepingUnit":"SU-002","Description":"01t2z000001vAasAAE&...
-1
votes
2
answers
3k
views
how to convert a list to list of lists in Javascript
I'm trying to turn a list into a list of lists. In this case I have a list similar to the following:
a = [ 1, 1, 1, 2, 3, 3]
and I would like to separate the same items for another list, like:
a = [[1,...
0
votes
1
answer
1k
views
Convert PDF file returned as byte[] in apex callout into blob and Save as file
I am making third party api call from Apex using below piece of code:-
HttpRequest req = new HttpRequest();
req.setEndpoint(endpoint);
req.setMethod('POST');
req.setBody(Body);
req.setHeader('Content-...
0
votes
1
answer
331
views
Convert Int Array to Blob
I have an Integer array using it as a ByteArray (It is a publicKey)
[-33,103,-48,-46,113 .......]
How can I convert it to Blob using Apex?
0
votes
0
answers
5k
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 ...
0
votes
1
answer
149
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 ...
1
vote
1
answer
3k
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? ...
1
vote
1
answer
266
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 ...
2
votes
2
answers
1k
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 ...
0
votes
2
answers
526
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. ...
0
votes
1
answer
2k
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-...
0
votes
1
answer
2k
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-...
-2
votes
1
answer
987
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 ...
0
votes
2
answers
147
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.
...
-2
votes
1
answer
535
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 ...
0
votes
1
answer
2k
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:'...
0
votes
1
answer
299
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",
...
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=...
0
votes
1
answer
2k
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,...
0
votes
2
answers
2k
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. ...
0
votes
1
answer
376
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 ...
1
vote
1
answer
1k
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": [
{
...
0
votes
2
answers
1k
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;
...
0
votes
1
answer
281
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, ...
0
votes
0
answers
222
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'){
...
0
votes
1
answer
2k
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?
...
-4
votes
2
answers
972
views
JSON array into map with duplicate values [closed]
Final result when i tried the below code.
-1
votes
1
answer
12k
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&...
0
votes
1
answer
219
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
1
answer
291
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
2
answers
641
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
1
answer
618
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
1
answer
6k
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 ...