You need to sign in to do that
Don't have an account?
Madhusudan Singh 15
Create Map of Map
Hi All I am a newbie in SFDC and Apex. I am struggling with a silly thing from last night so seeking your help.
I already gone through multiple Links of Maps and List but it is all giving just a basic Idea but not to what I am expecting
I want to create an data structure like below. I used PHP code to simplify the understanding
array(
array(
'CustomerID' => '12345',
'CustomerName' = > 'Jhon',
'CustomerRevenue' => 30000,
),
array(
'CustomerID' => '78927',
'CustomerName' = > 'Martin',
'CustomerRevenue' => 200000,
),
);
Question1:
How to transform same values in Apex
Question2:
How to retrieve Customer Revenue when list is finalized
Question3: How to loop over this to identify each record
Question4:
Now let say if I have another record for existing customer I want 'CustomerRevenue' to be SumUp
For Example another values that I need to add in existing array is Like this
array(
'CustomerID' => '12345',
'CustomerName' = > 'Jhon',
'CustomerRevenue' => 50000,
),
Now my new array should be like
array(
array(
'CustomerID' => '12345',
'CustomerName' = > 'Jhon',
'CustomerRevenue' => 80000, // This value is changed
),
array(
'CustomerID' => '78927',
'CustomerName' = > 'Martin',
'CustomerRevenue' => 200000,
),
);
Regards
Madhusudan Singh
I already gone through multiple Links of Maps and List but it is all giving just a basic Idea but not to what I am expecting
I want to create an data structure like below. I used PHP code to simplify the understanding
array(
array(
'CustomerID' => '12345',
'CustomerName' = > 'Jhon',
'CustomerRevenue' => 30000,
),
array(
'CustomerID' => '78927',
'CustomerName' = > 'Martin',
'CustomerRevenue' => 200000,
),
);
Question1:
How to transform same values in Apex
Question2:
How to retrieve Customer Revenue when list is finalized
Question3: How to loop over this to identify each record
Question4:
Now let say if I have another record for existing customer I want 'CustomerRevenue' to be SumUp
For Example another values that I need to add in existing array is Like this
array(
'CustomerID' => '12345',
'CustomerName' = > 'Jhon',
'CustomerRevenue' => 50000,
),
Now my new array should be like
array(
array(
'CustomerID' => '12345',
'CustomerName' = > 'Jhon',
'CustomerRevenue' => 80000, // This value is changed
),
array(
'CustomerID' => '78927',
'CustomerName' = > 'Martin',
'CustomerRevenue' => 200000,
),
);
Regards
Madhusudan Singh
The code will look something like this:
But I would sugggest passing such data structure as a JSON object. It is much more easier more to work with a JSON object.
Let me know if it helps.
Thanks!