0
votes

How to pass an argument into method when is in map?

I'm trying to create excel file with dynamic values from table. In map I have some references to records in table like BOM.BOMid and I want to pass this like an argument to this function not like str:

Map  map = new Map(Types::Integer, Types::Container);
MapEnumerator en = new MapEnumerator(map); 

map.insert(1, bom.ItemId);

xlsWorkSheet.cells().item(row,column).value(<value from map>);column++;
1
Which table map are you using? And could you show some more of your code and the current and expected output? - FH-Inway
I'm using Map as collection - not from Data Dictionary - user3824908

1 Answers

4
votes

If you used map.insert(1, bom.ItemId); to add an element to the map, you can retrieve the value as follows:

Map map = new Map(Types::Integer, Types::String);
ItemId value;
...
if (map.exists(1))
{
    value = map.lookup(1);
}

You can also make use of MapEnumerator as follows:

//int key;
...
MapEnumerator en = map.getEnumerator();
while (enum.moveNext())
{
    //key = enum.currentKey();
    value = enum.currentValue();
    ...
}