Hi, I am trying to use matches activity to read different pattern of word document information. I am wondering how to use multiple matches activity so that when I run the program, it is able to check all matches activity and give me the output.
Please be more elaborate or provide some sample input for the forum community to understand your problem better.
okay so I have this matches activity here which reads the pattern: “Module\sCode:\s[A-Za-z]{2,3}[0-9]{3,4}”
I want to have other matches activity to read module name or other information. How do I create multiple matches activity ?
Just like you did it in the first case. Either use another Matches activity OR use the .net System.Text.RegularExpressions.Regex.Match (or Matches) method.
But when I add a new matches activity I need the condition that It has to be > 0 like in this case,
how do I have multiple conditions that will be checked all together when I run the entire program. I want it to check all the condition that I have which is it cannot be null. I don want it to just check 1.
Why don’t you use multiple matches activities and use a SINGLE if condition where you check if modulecode.count>0 AND modulename.count>0 AND…?
Ok, but for module code say I have 3 files that have no module code and I have the condition that module code cannot be empty, its just module code that is empty but the rest of my information like module name etc will not be displayed as module code is empty and the row will not be created. How do I create the row even if the values is empty ?
Could you share your workflow here?
my add data row
That’s because as per the workflow, the records will only be added IFF both module code and module name exist for a particular file. If it’s not necessary for both of those to have a value, use OR instead of AND and try.
If i use OR i will have this error:
I need to extract both module code and module name together. If its empty, the column will just be empty. If i do not have the if condition it will have the null error. I just need to extract it whether it has values or empty.
wait let me run the output for module code alone and show u what i mean
You will obviously get an error, Jovian, for you’re trying to convert a null value to a string.
You’ll need to make multiple checks so as to be sure you don’t end up trying to use null values. Which is why I’m asking you to upload your workflow here, not the screenshots so that I can tell you exactly what I mean.
Module Code retrieval.xaml (13.4 KB)
After every matches activity, you NEED to check if the result is not null, since if you use the output variable which is null, you’ll end up getting the same exception. So always check if the output is not null. If it isn’t, put the value in a string variable and use it. If matches activity returns null, your string variable will stay empty, so when you try to use the string variable, instead of facing any exceptions, you’ll just end up writing an empty string onto the datatable.
@siddharth How do I do what you just wrote ? Like how do I do the checking of the output is not null?
Module Code retrieval.xaml (14.9 KB)
Try this and let me know if you’re getting all your 94 records.
okay I will run it and get back to you in about 10-15 minutes
meanwhile may I ask does putting str infront means converting to string value or is it just the variable name?