We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [array]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
40 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
38 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
53 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
126 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
32 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
73 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
292 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
56 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
32 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
89 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 " " .
0
votes
0answers
20 views

Passing Javascript Array to Apex Controller always results in null values [duplicate]

I have a Visualforce page where I want to pass a javascript array in Visualforce to my Apex Controller. However the values are always null in my List in Apex. I have a commandButton that fires ...
5
votes
1answer
1k 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
2k 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
79 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
59 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
365 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
504 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
50 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
95 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
78 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
396 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
52 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
589 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
58 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
439 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
414 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
978 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
962 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 ...
1
vote
2answers
367 views

Deduplicate array in javascript based on id value in array

I have a array which is a collection of 2 arrays which has duplicate Id records how do I deduplicate these in javascript. Filter is my primary array to which I add opleidingfilter. Filter array ends ...
0
votes
1answer
182 views

How to make a fieldname dynamic in a javascript filter

I have a javascript filter which works fine. I have a field on which I filter an array. What I would like to do is to make this fieldname "Categorie__c" dynamic. I tried with a concatenate but this ...
2
votes
1answer
33 views

Order of rendered list items differs from items order in Javascript

I have a following Aura code sample: action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { var arr = [].concat(component.get("v....
0
votes
1answer
1k views

How to define a field value of an object in javascript

I have an iteration over the values of a picklist in a lightning component. It dynamically generates checkboxes for every value of this picklist. I want to be able to use the value of this picklist ...
1
vote
1answer
381 views

How to fetch the accounts based on a value checkbox

I have a dynamic checkbox generator which is bound by city on the account which works fine all cities are rendered with a corresponding checkbox. When I select the checkbox a city is added to a list ...
0
votes
1answer
53 views

How can I order an array by date and then extract only portions based on top%?

I have a list of email records that I need to order by recency, there is a field in the array called 'last_opened', and I then need to extract certain amounts only. e.g. group a - 1.6% (322 records) ...
1
vote
1answer
719 views

Array or List of Big Objects as parameter for AuraEnabled controller

Does Salesforce support passing an array or list of big objects as a parameter for an AuraEnabled controller method? In other words can I pass from a lightning component javascript controller an array ...
1
vote
2answers
3k views

How To Split String by space and store each character or substring in array

How To Split String by space and store each character or substring in array I have: String - '(1 OR 2) AND 3' I need in this way: String [] filterLogicSplittedbySpace=new String[]{'(', '1', 'OR', ...
6
votes
3answers
4k views

Apex Array Slice

Sometimes I like to use a Queueable to perform work on a list of Ids or sObjects over the heaver Batchable Interface. However, to do this, we need a very solid implementation of an Array slice ...
5
votes
1answer
1k views

Pre-defined Length List of Lists

Per the docs on Lists, I can use array notation to create a list of pre-allocated length: List<String> colors = new String[1]; However, replacing the primitive String type with a list doesn't ...
4
votes
2answers
155 views

Cast arrays in Apex

Its been a long time since I casted an array and cant remember if it can be done the way Im hoping. I have an array of type Row (Row[] rows) that is returned from a method. The method I need to pass ...
0
votes
1answer
1k views

Issue passing values to a list - Lightning component

I have been developing a lightning component to add products and can't seem to get my ids pushing to my productsList. My current revelant code is as follows: CMP <aura:component controller="...
3
votes
2answers
205 views

Alternative for many if/then AMPscript statements?

I'm guessing there is a more efficient way for me to handle the following scenario and am looking for some advice. Say I have 20 different Cities, abbreviated in my database by 3 letters. LOS, for ...
0
votes
1answer
78 views

Not able to display Multiple string in visualforce page from controller

I have a Multiple Product and each has it's own UnitPrice i am just passing it to String variable and store it inside the for loop but not sure How to display each of them in visualforce page here ...
0
votes
1answer
2k views

Convert String array to Set of string in apex class

Can someone please help me to convert String array values to Set of string? I have below code where it says Set is not getting populated from string array. Criteria=[SELECT Franchise__c FROM ...
0
votes
1answer
283 views

Display list in triggered send email based on supplied data

I have only recently started using the salesforce marketing cloud (exact target) to send out emails, so if there's something conceptually wrong with my question, forgive me :). So let's say I have ...
1
vote
3answers
507 views

Random Access to Array

Is the array-object in Salesforce really an array, or is it a list "disguised" as an array? Specifically: Is the access of myArray[3] really random (="quick") or does the runtime need to iterate over ...
1
vote
1answer
63 views

My custom object holding a list of another custom object

Maybe I am not understanding how salesforce works but I am trying to link up my custom object named "Program" to hold an array (or list) of another custom object I have called "Student". The structure ...
1
vote
1answer
141 views

Logic for a parsed JSON list?

Is it possible to have logic on a parsed JSON list? I have my entire list saved into a variable 'info' and and want to look at the parsed information and write a conditional for it. My end goal is to ...
1
vote
1answer
806 views

Convert String to array

I have a string ex.(a,b,c) which is inputted in a textarea(long). how can I convert it into array in apex trigger? Thanks in advance.
3
votes
0answers
2k views

How do I access an array index referenced by attribute?

I am totally new to Lightning, and I come from a JavaScript background. This is what I have so far. <aura:attribute name="Packages" type="Map" default="{p1: {name: 'Package 1', price: '2500 $'}, ...