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:
then you can use:
sugested reading:
A Map (also known as an associative array, dictionary, table, and hash) is an unordered collection of object references. The elements in a Map collection are accessed by a key value. The keys used in a Map can be of any class. When we insert into a...
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:
map1 and map2 are arrays
2nd object in each of it it’s wrong
correct can look like:
these are 2 arrays
this:
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
system
Closed
February 10, 2022, 9:18am
10
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.