I have array with few invoices and one of these invoices name stats with “Invoice” keyword.
I have to add the invoice whose name start with “Invoice” at 0th position of array or list and remaining invoices need to added to other position except oth position so that I can use that in further steps.
arrValues.Where(Function(x) x.StartsWith(“A”)).Concat(arrValues.Where(Function(x) Not x.StartsWith(“A”))).ToArray
In general Lists are to prefer for such tasks. In case of the element is not present and is to insert e.g. the InsertAt method from lists can be used within an invoke method activity.
filesPath = filesPath.Where(Function(x) x.StartsWith(“Invoice”)).Concat(filesPath.Where(Function(x) Not x.StartsWith(“Invoice”))).ToArray
when I am printing this string array, it is not printing Invoice named PDF at 1st position but giving at last location. Can u please check what went wrong
the item representing the invoice is starting in the filename with invoicebut not in entry of filesPath (The part of containing folder is for all the same)
for working on fileName base we can do:
arr1 = filesPath.Where(Function(x) Path.GetFileName(x).ToUpper.StartsWith(“INVOICE”)).toArray
arr2 = filesPath.Where(Function(x) Not Path.GetFileName(x).ToUpper.StartsWith(“INVOICE”)).toArray
FilesPathOrdered = arr1.Concat(arr2).ToArray