I am unable to assigning value in string array in for-each loop.
You need to pass the index and value to the string array,
Hi @pankajs3
- Use assignactivity and declare array of string.
- Then assign value to the variable {“First”,“Name”,“Last”}
3.Use For Each Activity.
Hope this might be helpful to you.
cheers
Happy learning
i want to assign value dynamically in string array in for-each loop. While assigining value i am getting error:
system nullreferenceexception object reference not set to an instance of an object UiPath
First solution will work @pankajs3 , try and let me know if you get the same, make sure the ArrayString is a string array type variable
yes am doing same way as you mentioned in first solution but getting error which i mention in my previous reply.
If you have null values in the DB, it won’t accept. So, give a if condition above the assign and skip the values if the values are null… Check that by using a message box @pankajs3
@HareeshMR Can you tell me how to declare and initialize the String array in uipath
In the variables pane, click on new variable and give a name. Then in the type, click thrice . you will get a drop down as show and select Array of [T]
Then select String in that
just like mate @pattyricarte mentioned above
@HareeshMR ow to initialize array of string, before adding any number of elements in String array in for-each loop
Come again @pankajs3,
I dont understand
@HareeshMR
Which above part you mentioned is declared part, but how to initialize an Array.
“arrayString String” is declared part, How to initialized it.
Ohh, I forgot that @pankajs3
Here it is : StringArray = new string(){}
Thanks @HareeshMR
Can we add any number of element with this initializing
Yes @pankajs3,
Here is the sample workflow to enter the values into a string array from data table.
DataTablesAndExcel.xaml (10.7 KB)
First of all, we are declaring and initializing a array with the particular length with the number of rows in a datatable and then we are adding the data to the array based on the index
Hope this helps and let me know if you have any doubts
That’s i was looking for.
Thanks @HareeshMR
Glad to help @pankajs3
@HareeshMR
i don’t know, How to close the topic?
Just marking the best answer you find as useful
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.