Hello, everyone! I have a field, for a specific vendor, that I need to replace the first character. The OCR is recognizing the first character of InvoiceNumber as "I" when it should be "L". I have created a rule to modify the InvoiceNumber field based on the vendor ID field but I am having a hard time completing the script.
For vbScript I know it would be something along the lines of: InvoiceNumber.Replace("I","L") but I am not entirely sure how to structure the script. I am open to using vbScript of C#
If anyone has an suggestions, I would greatly appreciate it.
Thanks in advance!
Comments
3 comments
Hi,
Please try with this script:
string vendorId = Context.Field("VendorId").Text;
string invoiceNumber = Context.Field("InvoiceNumber").Text;
if (vendorId == "33" && invoiceNumber.StartsWith("l"))
{
//Context.Field("InvoiceNumber").Text = invoiceNumber.Replace("l", "L");
Context.Field("InvoiceNumber").Text = "L" + invoiceNumber.Substring(1);
}
You can use Replace method, but you should first check if this Vendor is sending invoices with more letters inside of InvoiceNumber field, as there can be multiple "L" letters. This is why I added StartsWith, which you can remove if there is only one letter prefix.
For example: "lol123" can be replaced to "LoL123" instead of "Lol123" if you use just Replace method.
Best regards,
Vladimir
Vladimir,
Thank you so much for your quick response. The script works flawlessly! I greatly appreciate the assistance!
Dollar General Corporation, an American chain dgcustomerfist.com of assortment stores,was began by James Luther Turner with his lone youngster Cal Turner (Sr.). Partnership's first store was opened in Springfield, Ky. on June 1, 1955 . Official DGCustomerFirst Survey subtleties. The base camp of the enterprise is in 100 Mission Ridge, Goodlettsville, Tennessee and The United States. In addition, the store has 14,000 areas everywhere throughout the world. The Chairman and the CEO of the organization are Michael M. Calbert and Todd Vasos separately.
Please sign in to leave a comment.