M MathiasM Active Member Licensed User May 21, 2019 #1 Hello I want to pass a Map.Values to database.ExecNonQuery2() as second parameter. I thought that should work, because Map.Values resturns a IterableList, but apparently a IterableList and List are 2 different things. This is my code: Code: Copy db.ExecNonQuery2(query, columnMap.Values) The error that is being logged is: anywheresoftware.b4a.objects.collections.Map$IterableMap cannot be cast to java.util.List Is there a way to cast this internally? I could write a Sub that converts it into a list, but how could I accept a IterableList as argument for my function? This doesn't work: Code: Copy Private Sub CastIterableListToList(iterable As IterableList) As List Dim lst As List lst.Initialize For Each s As String In iterable lst.Add(s) Next Return lst End Sub Thanks! Last edited: May 21, 2019
Hello I want to pass a Map.Values to database.ExecNonQuery2() as second parameter. I thought that should work, because Map.Values resturns a IterableList, but apparently a IterableList and List are 2 different things. This is my code: Code: Copy db.ExecNonQuery2(query, columnMap.Values) The error that is being logged is: anywheresoftware.b4a.objects.collections.Map$IterableMap cannot be cast to java.util.List Is there a way to cast this internally? I could write a Sub that converts it into a list, but how could I accept a IterableList as argument for my function? This doesn't work: Code: Copy Private Sub CastIterableListToList(iterable As IterableList) As List Dim lst As List lst.Initialize For Each s As String In iterable lst.Add(s) Next Return lst End Sub Thanks!
Daestrum Expert Licensed User Longtime User May 21, 2019 #2 You just need to pass the map Code: Copy Private Sub CastMapToList(theMap As map) As List Dim lst As List lst.Initialize For Each s As object In theMap.Values lst.Add(s) Next Return lst End Sub Upvote 0
You just need to pass the map Code: Copy Private Sub CastMapToList(theMap As map) As List Dim lst As List lst.Initialize For Each s As object In theMap.Values lst.Add(s) Next Return lst End Sub
M MathiasM Active Member Licensed User May 21, 2019 #3 I'm so retarded, this solution came to my mind a few minutes ago while doing something totally different. Thanks for thinking with me! Upvote 0
I'm so retarded, this solution came to my mind a few minutes ago while doing something totally different. Thanks for thinking with me!