Hi, I'm trying to use a column with a string created from an OCR scan of an image to populate other columns in a form. So far my string looks something like this
Order# 0068348 BOL# XXXXX o From: DOWAGIAC, MI 49047 To: IRON RIDGE, WI 53035 call Ship date: April 28, 2022, 0001 - 2359 Delivery date: April 29, 2022, 0001 - 2359 Carrier Instructions: , Loaded miles: 239, Empty miles: 167, leave one copy of the BOL DO NOT BOBTAIL INTO THIS LOCATION NO REEFER TRAILERS AT THIS LOCATION MUST BRING A DRY VAN
And I am trying to extract something like the "239" loaded miles. So I'm trying to make a virtual column that says find "Loaded miles: " and then return the number after it. Are there any text expressions I can use to do that? Thanks
Solved! Go to Solution.
Hello @Lukevancleave , try with this expression:
MID([stringColumn],
FIND(" Loaded miles: ",[stringColumn])+LEN(" Loaded miles: "),
FIND(", Empty miles:",[stringColumn])-FIND(" Loaded miles: ",[stringColumn])-LEN(" Loaded miles: ")
)
Nice one @Rafael_ANEIC-PY
@Lukevancleave : You could also try the following expression for loaded miles if you are not likely to have mentions (ie @) in your OCR string and your OCR pattern is standard. Please test well.
SUBSTITUTE(EXTRACTMENTIONS(SUBSTITUTE([OCRString],"Loaded miles: ","@")),"@","")
And this one for empty miles:
SUBSTITUTE(EXTRACTMENTIONS(SUBSTITUTE([OCRString],"Empty miles: ","@")),"@","")
https://help.appsheet.com/en/articles/3497820-extractmentions
Adding one more possibility , again with a EXTARCT() variant and with a condition.
One could use EXTRACTNUMBERS()
For loaded miles:
EXTRACTNUMBERS(MID([OCRString], FIND("Loaded miles: ",[OCRString])+14,6))
I believe the above will work well for all conditions.
For Empty miles, with two conditions:
If empty miles are not going to be greater then 3 digits as mentioned, and if the empty miles will always be followed by a text message, then one could use
EXTRACTNUMBERS(MID([OcrString], FIND("Empty miles: ",[OCRString])+13, 3))
These may or may not work in current post's requirement. Just thought of adding above in case someone else finds use cases for using EXTRAXT() functions for extracting part of strings.
User | Count |
---|---|
35 | |
9 | |
3 | |
3 | |
2 |