How to store multiple arrays in a parent array?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2023 07:59 AM
I'm having two arrays
array 1 = [ a, b,c]
array 2 = [x,y,z]
Now I need to store all these two array's in some place and if I call a[0] then I need to get output as a,b,c and if I print a[1] then I need output as x,y,z
can some one please help me how to satisfy this requirement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2023 10:32 AM
Hi,
Thanks for sharing the code, but after pushing array1 and array2.. I'm passing mail through to email script through event.. in email script.. array[0] is not working..can you please help me what I did the mistake?
var ar1 = [1,2,3,4]
var ar2 = [5,6,7,8]
var ar1 = [1,2,3,4]
var ar2 = [5,6,7,8]
var array = [];
array.push(ar1);
array.push(ar2);
gs.eventQueue('sathwik', current, array, null)
In email script, i have written like below
var t = event.parm1.toString();
template.print(t[0]);
template.print(t[1]);
in notification I am getting output as " 1, that's it.. what is wrong ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2023 11:18 AM - edited 01-02-2023 11:52 AM
Hi,
Run below in background and change code as per below code for your mail script
var ar1 = [1,2,3,4]
var ar2 = [5,6,7,8]
var array = [];
array.push(ar1);
array.push(ar2);
var passArgs=JSON.stringify(array)
//gs.eventQueue('sathwik', current, passArgs, null)
//var t = event.parm1.toString();
var parsedArray=JSON.parse(passArgs);//In your case pass t here
gs.info(parsedArray[1])
//template.print(parsedArray[0]);
//template.print(parsedArray[1]);
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2023 10:34 AM