Blueforcer Well-Known Member Licensed User Longtime User Jul 18, 2018 #1 I have a map that contains maps and lists. How can I check if Key=X is a list or a map? Because At the end I need to have the single maps and the maps in the lists.
I have a map that contains maps and lists. How can I check if Key=X is a list or a map? Because At the end I need to have the single maps and the maps in the lists.
Claudio Oliveira Active Member Licensed User Longtime User Jul 18, 2018 #2 Supposing your map variable is called M, try: B4X: If m.Get(x) Is List Then ... End If if m.Get(x) Is Map Then ... End If Upvote 0
Supposing your map variable is called M, try: B4X: If m.Get(x) Is List Then ... End If if m.Get(x) Is Map Then ... End If
Erel B4X founder Staff member Licensed User Longtime User Jul 19, 2018 #3 In most cases it is a mistake to combine different types in the same collection. Maybe you need to have a custom type as the value. Upvote 0
In most cases it is a mistake to combine different types in the same collection. Maybe you need to have a custom type as the value.
Blueforcer Well-Known Member Licensed User Longtime User Jul 19, 2018 #4 unfortunately this map is generated by xml2map. Screen Nr 0 returns as a map and Screen Nr 1 returns as a list of maps if i want to get the "Show" ´s B4X: <Screen Nr="0"> <Show Nr="0"> <Type>Picture</Type> <Nr>0</Nr> <Pos>0,0,10000,10000</Pos> </Show> </Screen> <Screen Nr="1"> <Show Nr="0"> <Type>Text</Type> <Nr>1</Nr> <Pos>0,0,10000,470</Pos> </Show> <Show Nr="1"> <Type>ScreenButton</Type> <Nr>0</Nr> <Pos>0,470,1667,2250</Pos> </Show> </Screen> Upvote 0
unfortunately this map is generated by xml2map. Screen Nr 0 returns as a map and Screen Nr 1 returns as a list of maps if i want to get the "Show" ´s B4X: <Screen Nr="0"> <Show Nr="0"> <Type>Picture</Type> <Nr>0</Nr> <Pos>0,0,10000,10000</Pos> </Show> </Screen> <Screen Nr="1"> <Show Nr="0"> <Type>Text</Type> <Nr>1</Nr> <Pos>0,0,10000,470</Pos> </Show> <Show Nr="1"> <Type>ScreenButton</Type> <Nr>0</Nr> <Pos>0,470,1667,2250</Pos> </Show> </Screen>
Erel B4X founder Staff member Licensed User Longtime User Jul 19, 2018 #5 In this case you should indeed check the type... Upvote 0