I need the Pack number under a heading (substring). For example:
VARIABLE NAME VALUE
Total Product(s) in batch 49
Successfully Uploaded 44
Article Created 45
Under QC Approval 5
Please share a regex code or any other way of getting this.
@Rounak_Kumar - I would create 4 separate variables, one for each of the values you want. I will call these TotalProducts, SuccessfulUpload, ArticleCreated, and QCApproval. Each one of these variables will be found individually using string manipulation on the original the Summary string.
I have based these regex on your sampe text - mostly the only thing to change is the word(s) to look for in the positive lookahead. Below are the expressions:
How this regex works: It looks for the keyword in the preceding line (newline is indicated by \r\n) and ignores all of the information in the next line until it gets to digits that is immediately before the next newline or end of input
I tried this solution in text file. It is working fine. But when I tried to do the same thing in excel (pasted this text in one cell of excel) and tried to extract using same method, UIPath is throwing Error:
System.NullReferenceException: Object reference not set to an instance of an object.
I tried to print the text but it look the same as the text in Notepad.
How are you converting the information from excel into a string variable to run the regex?
If you are using read range that will give you a datatable in return. You have to find the specific row and column in your datatable to convert it to string. For example: dt1.rows(0).item(0).tostring would turn the first row and first column into a string.
If you use read cell, it should just go straight into a string variable if you choose to do so in the output property of the activity
Just an fyi - NullReferenceException is a common error that occurs. It just means you are trying to use a variable in your code that was never initialized, so it is null
Hi Dave,
I am using Read Cell activity.
I have attached my UIPath file and Sample excel file that I used.
Please try it once and let me know where I am doing wrong.
Thanks.