Regex pattern
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 11:58 AM
Hi all,
i've a collection field with dynamic column name but always with ONE row.
I need to check if this row contains at least one "YES" value.
I didn't want to loop through each collection, so my idea is to use:
1) Get collection as CSV (in that case i have one text data item with all values separated by a comma) but now, how can i check if at least one value after comma (,) is YES?
Can i use a regex pattern?
Thanks in advance
------------------------------
Vrat Himbo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 02:47 PM
------------------------------
Harshit Rawat
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 02:57 PM
unfortunately, i haven't the same column name, only the values and first row are fixed.
Like this:
Column1?? Column2?? Column3?? Column4??
YES NO YES NO
And i need to check if at least one value of the first row is yes. I don't want to use a loop, so i've tried to convert collection to CSV (text) but i don't know how can i check it, with regex or in other way
------------------------------
Vrat Himbo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 03:07 PM
It ensures the entire cell content is YES, so "YESTERDAY" wouldn't match, and it also discards any leading spaces or if it is surrounded by quotation marks that some CSV formats will throw in there. Keep in mind it'll match if a column is called "YES" as well, so it might be wise to trim the header line off before running this.
Personally, I'd shoot for a more reusable option; you could create an action that takes a collection and searches for any values. With a code stage you'd be able to iterate over all of the fields in the collection and make sure it's a proper match as opposed to a regex search.
------------------------------
Nicholas Zejdlik
RPA Developer
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 03:36 PM
As you said you have taken the text into a data item please share your thoughts for the below approach
@VratHimbo
------------------------------
Harshit Rawat
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 03:45 PM
The only problem is if i have a column with the name starts with YES.
For example Column1??,YES+*Column2,NO,NO,NO
------------------------------
Vrat Himbo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 03:47 PM
Thank you, i've tested the regex but in this case it match also with a column name that contains YES, is correct?
I can do it in C#? Do you know if there is something already done?
Is possible to use a LinQ Expression to check it?
Thanks in advance
------------------------------
Vrat Himbo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 04:13 PM
found = table.AsEnumerable().Any(row => {
foreach (DataColumn col in table.Columns) {
if (row[col].ToString() == valueToFind) {
return true;
}
}
return false;
});
------------------------------
Nicholas Zejdlik
RPA Developer
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 04:53 PM
I put in input Datatable & ValueToFInd (text), a boolean in output, imported System.Linq.dll and the System.Linq. And i've imported system.data.datasetextensions. But i've this problem. How can i fix it? Thanks
------------------------------
Vrat Himbo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-21 05:16 PM
------------------------------
Vrat Himbo
------------------------------
