Questions tagged [array]
The array tag has no usage guidance.
133
questions
0
votes
1
answer
46
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
92
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
0
answers
39
views
Put single quote to array - Apex
Hello guys I have a list of ids like this one:
list = [ ekenre898ergk, eklrgheoñirje98, lkahger89 ]
And I need to convert it as:
list = [ 'ekenre898ergk', 'eklrgheoñirje98', 'lkahger89' ]
I do not ...
3
votes
1
answer
68
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
41
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
82
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
48
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 ...
0
votes
0
answers
89
views
How to SUM in APEX with External Object
I have this query:
String query = 'SELECT Month__c, Client__c, Amount__c FROM externalObj ' + whereClause;
In the query you can have the same client in the same month with different amount.
how can i ...
1
vote
1
answer
76
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
50
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
871
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
75
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
37
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&...
0
votes
0
answers
44
views
How to add default label to picklist / array of field when using lightningsnapin:prechatAPI e.x "Please select from dropdown"
We have live chat implementation , where we are using lightningsnapin:prechatAPI to prepare list as below
controller :
onInit: function(cmp, evt, hlp) {
// Get pre-chat fields defined in setup using ...
-1
votes
2
answers
2k
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
811
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
124
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
2k
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
96
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
2k
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
189
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
642
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
459
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
1k
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
1k
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-...
-1
votes
1
answer
543
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
88
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
361
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
1k
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
188
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
75
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
1k
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
294
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
911
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
896
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
230
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
152
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
982
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
602
views
JSON array into map with duplicate values [closed]
Final result when i tried the below code.
-1
votes
1
answer
9k
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
852
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 ...
0
votes
1
answer
192
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
246
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
374
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
443
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
4k
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
3
answers
4k
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
1
answer
348
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
1
answer
5k
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 = []...