How to utilize an array of string variables?

Hi guys

I have the string variable P01 that can be displayed in the first message box without issue but if I place that variable inside an array of strings and I try to use the message box again by pointing to it using the array with the correct index I get a blanc message despite Uipath giving me no error…

What can I do to utilize that variable inside an array of string ?

My array type is string[] meaning an array of strings

Many thanks

Hi

Is ArraySp variable having value till 44th index
Pls ensure that

And if possible can I see the expression used with assign activity for P01

And also a screenshot of message box with output

Try mentioning like this ArraySp(44).ToString

Cheers @kaiji_San

Detail of my Array

Result of 1st message box

Result of 2nd message box

Result of 3rd message box

I don’t need an array of hard coded strings but an array of string variables, how can I achieve that ?

Did we try with this @kaiji_San

1 Like

Yes I tried, it gives an error ‘‘object reference not set’’ something like that, ArraySp(44) is already a string because P01 is a string

Hi,

We need to update each string value in array just before MessageBox as the following.

ArraySp(44) = P01

It’s because String type behave as Value type.

Please see the following document , FYI

Regards,

1 Like

Try assigning it to a variable in assign activity
And then pass that new string variable in message box

That should work fine

That is use a assign activity like this

Strinput = ArraySp(44).ToString

Now use a message box and mention that Strinput

Cheers @kaiji_San

1 Like

Do you mean this ?

Hi,

Can you try as the following?

img20211104-7

Regards,

1 Like

No Sir this doesn’t work

Yes this work but my array of string variables becomes totally useless if I need do that… if we can’t use an array of string variables I will need to rethink my whole program

Fine

In that case you can hold the values with a variable or a key, using Dictionary variable instead of a array

Here in dictionary you can refer all the values with its key

Have a view on this doc on how to use dictionary variable

Cheers @kaiji_San

1 Like

Thank you I will look into it

1 Like

Sure @kaiji_San

1 Like

I am sorry Mate, your solution was perfectly valid indeed, I was just too slow to realise it.

Many thanks

1 Like

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