Put arrays in data table then output to excel

Hello!

I have 4 arrays that I want to put in a data table and output to excel.

The first array is a blank array where I put inside the data table by a loop.
The second, third and fourth array are predefined.

What I planned for the first array is this:
1st array(POArray) = {“116808”,“116808”,“116808”}

these are my predefined arrays:
2nd array(LineItemArray) = {“1”,“2”,“3”}
3rd array(QuantityArray) = {“1”,“1”,“5”}
4th array(ResultArray) = {“YES”,“NO”,“YES”}
then create a datatable from it and output to an excel file.

what comes out is this:
image

but I wanted it to be this:
image

is there a way I can output where A1:A3 contains “116808” ?

This is the xaml file I made:
_test2.xaml (16.0 KB)

Remove the blank space from first array, and then update the datatable.

1 Like

@Manish540

I started with a blank array:

Where can I remove the extra space?

newArr = POArray.Where(Function(x) Not String.IsNullOrWhiteSpace(x)).ToArray

write this in a assign activity then newArr will contain the poarray data without any empty values

1 Like

@Manish540
@Karun

Thank you for the help. Apparently the extra space was happening due to this:

An additional space from the start because of an additional row in my build data table activity :sweat_smile:

@loginerror thank you for changing the tag to my topic. I appreciate it :blush:

2 Likes

To anyone who might look into this topic in the future:

This is the scenario:
I have 4 arrays that I want to insert to an excel file:

  • 1st aray(POArray) = {“116808”,“116808”,“116808”}[*]
  • 2nd array(LineItemArray) = {“1”,“2”,“3”}
  • 3rd array(QuantityArray) = {“1”,“1”,“5”}
  • 4th array(ResultArray) = {“YES”,“NO”,“YES”}

[*] the POArray is a new string array and was filled up by the for each loop

and I managed to do this:

image

While I was working on this, I was getting a fourth item in my array. I first removed the last element/item by going to this post: Remove last element/item in an array

but I managed to do the same result by simply adding “-1” in my assign value for setting up a new string array.

image

To those who would like to see the last item removed using the method in the link, remove the “-1” and comment the Assign activity in the “Remove last item in array” CommentOut activity.

image

Check out my revised xaml file here: _test2.xaml (24.9 KB)

Thank you and Good luck! :smiley:

*but I managed to get the same result by simply adding “-1” in my assign value for setting up a new string array.

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