kaiji_San
(kaiji San)
November 4, 2021, 9:24am
1
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
kaiji_San
(kaiji San)
November 4, 2021, 9:51am
3
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
kaiji_San
(kaiji San)
November 4, 2021, 9:57am
5
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
Yoichi
(Yoichi)
November 4, 2021, 9:58am
6
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
Yoichi
(Yoichi)
November 4, 2021, 10:21am
9
Hi,
Can you try as the following?
Regards,
2 Likes
kaiji_San
(kaiji San)
November 4, 2021, 10:24am
11
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
Hi, I tried to use the dictionary recently.
I met some problem that I tried to retrieve the particular value with its key.
For example: I have a Dictionary(Of String, Double) {“AA”, 0.1}, {“BB”, 0.2},
but I failed when I used Value = Dictionary(“BB”)
I searched some case but I felt confused.
A case said that the variable type of Dictionary is KeyValuePair<Of String, Double> if I
want to use dictionary.
Did I use the wrong Data Type, not the Dictionary<Of String, Double>, but the KeyValue…
Cheers @kaiji_San
1 Like
kaiji_San
(kaiji San)
November 4, 2021, 10:35am
13
Thank you I will look into it
1 Like
kaiji_San
(kaiji San)
November 4, 2021, 1:45pm
15
I am sorry Mate, your solution was perfectly valid indeed, I was just too slow to realise it.
Many thanks
1 Like
system
(system)
Closed
November 7, 2021, 1:46pm
16
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.