Array check

I am getting below output after logging message of array, now i want to check whether this array is empty

Create array as below
. image

getting output as below
image

Please help

@amruta_pawar To check if the Expression gives out any Values, At the End of the Expression after ToArray(), You can use .Count>0 to check if it contains any value.

1 Like

its not working may be some blanks are there is there any other way?

@amruta_pawar Can you provide us a Screenshot of how you are using it in the Workflow?
Is it giving an Error?

Merge.xlsx (8.6 KB) Sequence5.xaml (6.8 KB)

Please find attched sequence and excel file

@amruta_pawar Can you tell us What you actually want to do, Because the Sequence that you Provided gives me an Output as “Bye”. So I think it is working Accordingly :sweat_smile:

What do you want the workflow to do?

i wanted hi, is arrmail.count=0 will work?

@amruta_pawar Do you want to Check if the Array is Empty or Array is having some items?

yes the thing is i am getting array count as 1, but its empty.

@amruta_pawar Yes, What do you wanted to get? If you can Explain the Process , I’ll not be needing to Ask may Questions in this way :sweat_smile:

ok in my input file excel path and pdf paths are empty so my array should be blank it should not select any email id, but i am not getting it blank, can you check on that too whether i created right. then after that have to check empty or not.

@amruta_pawar So you only want to Select the rows which are having PDF path in them right?

yes, but in current example we dont have any path, so ideally not single email id should get select in array.

@amruta_pawar Check this Workflow :
Sequence5.xaml (7.5 KB)

The Count of the array is 0. Hence it Didn’t Select the rows which had Empty PDF Path Values in it

3 Likes

@amruta_pawar
Change LINQ to
dt.AsEnumerable.Where(function® Not String.IsNullOrWhiteSpace(r(“PDF Path”).ToString.Trim)).Select(function® r(“Email contact”).ToString()).Distinct().ToArray()

and change if condition to arrMail.Count = 0

then you will see Hi from message Box

2 Likes

@amruta_pawar
about why you will get system.String

toString on the array will dump out the datatype. I do feel you had the intention to output/inspect what is inside the array. Therefore you can do:

  • debugging / setting breakpoints (the recommended procedure)
  • bring it to a string e.g. String.Join("|",arrVariable)
1 Like

yessss, it worked thank you so much buddy :slight_smile:

1 Like

yes this worked too, thank you for your help.

1 Like

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