How to initialize an Three-Dimensional Array String [] [] []?

Only one question, for create a three dimension dictionary into variables panel, i will create a single dictionary and type in arguments (content) the three times assign?

When you create your Dictionary in the variable pane, you will have a Type that says Dictionary<String,Dictionary<String,Dictionary<String,Object>>>

To initialize each dictionary, you will need to use an Assign activity in the code, like what was shown above. That way you can assign the inner dictionaries to each key.

Regards.

1 Like

It looks like you are going down a different route, but to add to the topic, what you initially were using is nested arrays, not unlike a multidimensional array. However, because they are nested, each array needs to be initialized similar to what you were doing.

To fully initialize a 1x1x1 array, it would look similar to this:

For reference, a multidimensional array in regular VB is a lot simpler to use:

image

3 Likes

Nice, I did not know that UiPath has a code editor, however, how can u export that multidimensional array from the code editor to the RPA enviroment?

You can use the generic Object to pass it out.

Then convert it back to the 3 dimensional array using CType or one of the other conversion methods.

image

This converts the object back to an array, then gets the word at (0,0,0), which in this case is “Hello”.

3 Likes

Why u type in Value: “newObject” without space? Im looking this from my cellphone and i cant do tests, when i arrive to my computer i will try it but i think than uipath will generate an error on ‘newObject’.

Youre awesome! Thanks to all for support me

EDIT: Oh sorry i understand, newobject is reference for a new variable

Sorry, that is just my variable name, not making a ‘new’ anything. Probably should have used something else but I was typing fast. :slight_smile:

Yeah i saw that, i was editing my comment, thanks! In a few moments i tell u how is going on all

Works Perfect! Thank u @Tuhdae nice job, i owe you one.

1 Like

@Tuhdae thanks for sharing. That sounds more like what he was trying to do initially.
Just wanted to add as well that you can skip the Invoke Code like this:
image

image

I wonder if there is a Data Type for multi-dimensions, though :man_shrugging:

Although, I’m not sure what benefit this approach has, because the 3-dimensional array is the same as a 3-column DataTable… or am I looking at it wrong? I suppose it also has to do with how you are getting your data.

Regards.

2 Likes

No exactly looks like a 3-column datatable. The third dimension works as a ‘sheet’ in excel

Row (1D)
Row + Column (2D)
Row + Column + Page (3D)

(I think that’s how it works :sweat_smile: )

image

2 Likes

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