Array object into dictionary

Hello!

I’m having an issue with something already done.

I’ve found a code that has:

  • One variable dictionary called diccVar

I encounter this diccVar in an assign after a get credential like this:

  • Assign to: diccVar(“key”) value: new object {user,pass}

That was mindblowing for me :sweat_smile:

So how can I get this user and pass from that object that is in a dictionary?

Thank you for your time. :timer_clock:

Hello @kevin.dasilva

Plz refer to the below post.

You need to call the key and get the value from dictionary.

please confirm following:

the detailed datatype: Dictionary(String, Object)?

Depending on this we can help you on the steps to access the object array again.

lets assume following:
grafik

A dictionary of String, Object

We can add items to it and can also retrive it by using the key. But as it is returned as a generic object we cannot access the specifics. e.b. first item from the object array. Late binding issue:
grafik

But with the usage of DirectCast we can convert the returned value into the datatype that we do need. Afterwards we can deal with the value as usually we do for the specific datataype:

grafik

This is the code:

it is an object array into a dictionary.

how can I get the data?

Same that you call to any array
diccVar(“key”)(0) and
diccVar(“key”)(1)

as described above: using direct cast
arrCredentials = DirectCast(diccVar(“key”), object())

arrCredentials is of datatype: Object() - object Array

However we would suggest to switch to more datatype specific definitions, so the DirectCast can maybe ommited.

What is your main motivation? Storing the credentials within the dictionary?

1 Like

thank you ppr

I normally use ctype and work for me as well as directCast. Just what I need it :smiley:

I never use this kind of assign but I’d saw it on a code that was already developed by other person but they didn’t use the variables, I just want it to understand the logic about it and you’d solved it :slight_smile:

Thak you very much for the effor.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.