How to call a global variable map in a global variable list

map1=[“name1=Test”,“address1”=“India”] – added map as global variable
map2=[“name2=Test”,“address2”=“India”] – added map as global variable

List=[map1,map2] [type of the element is Globalvariable] --List added it as global variable.

So we call List element to get map1’s key and value???

Can anybody help

GlobaVariables are defined as map:
image
then you can use:


sugested reading:
https://www.tutorialspoint.com/groovy/groovy_maps.htm

also:

Thanks for the reply.
But still question remains the same.
As here I have added a list as a global variable and its are map which are also global variables.
So I am calling Globalvariable.List and trying to fetch list’s element that is a map, and trying to fetch its value from its key but getting null.

if this is how you defined them, it’s wrong:
image

  1. map1 and map2 are arrays
  2. 2nd object in each of it it’s wrong

correct can look like:
image
these are 2 arrays
this:
image
2 maps

show us your definition of objects
also have you defined global variable in profile you are using?

Two maps I have created in global variable .
One list added as global variable and added maps as its elements.
When fetching, not able to read elements of list bcz they are global variables and giving me null value.

you are right! it’s a bug if you define value in global variables as another GV it will be null

import internal.GlobalVariable

/**
 * This does not work
 */
/*
   <GlobalVariableEntity>
      <description></description>
      <initValue>[('address1') : 'India', ('name1') : 'Test']</initValue>
      <name>map1</name>
   </GlobalVariableEntity>
   <GlobalVariableEntity>
      <description></description>
      <initValue>[('address2') : 'India', ('name2') : 'Test']</initValue>
      <name>map2</name>
   </GlobalVariableEntity>
   <GlobalVariableEntity>
      <description></description>
      <initValue>[GlobalVariable.map2, GlobalVariable.map1]</initValue>
      <name>mapList</name>
   </GlobalVariableEntity>
   
 */

println GlobalVariable.myMap1

println GlobalVariable.myMap2

println GlobalVariable.mapList

/**
 * This is working
 */

/*
    <GlobalVariableEntity>
      <description></description>
      <initValue>[('address1') : 'India', ('name1') : 'Test']</initValue>
      <name>myMap1</name>
   </GlobalVariableEntity>
   <GlobalVariableEntity>
      <description></description>
      <initValue>[('address2') : 'India', ('name2') : 'Test']</initValue>
      <name>myMap2</name>
   </GlobalVariableEntity>
   <GlobalVariableEntity>
      <description></description>
      <initValue>[[('address1') : 'India', ('name1') : 'Test'], [('address2') : 'India', ('name2') : 'Test']]</initValue>
      <name>mapList</name>
   </GlobalVariableEntity>
*/

moving this discussion back to bugs