Hi,
I am running into issues trying to extract a value within a cell in Excel.
- I have 2 columns “OrderNumber” and “InvoiceNumber” in my datatable.
- if ordernumber doesn’t have any value,I need to extract it from my “InvoiceNumber” column
- the Invoice number is a concatenated value separated by hyphens as shown below. i need to extract the value after the last hyphen
- I am trying to use lastIndexof method but havent been successful so far.
Any help is greatly appreciated.
ppr
(Peter Preuss)
2
@parimala.prata
Welcome to Forum.
give a try on: row(InvoiceNumber).toString.Split("-"c).Last().Trim
Thank you.
I tried both of these below and the output doesnt seem to change.
- row(InvoiceNumber).toString.Split("-"c).Last().Trim
- row(“InvoiceNumber”).ToString.Substring (row(“InvoiceNumber”).ToString.LastIndexOf(“-“)+1)
ppr
(Peter Preuss)
4
can you post a sample value as text here? Thanks
Values in the InvoiceNumber column could be in any of the format below.
- COLL-103227712-0311969189
- 103143446-0311442428
- 103004206
ppr
(Peter Preuss)
6
@parimala.prata

I would suggest that you debug and inspect the row / Col Values
strange because the workflow was just working as designed until i tried to attempt this. Thank you for your input.
ppr
(Peter Preuss)
8
@parimala.prata
Also in the IF condition do the check on empty rows like this:
String.IsEmptyOrWhitespace(row(“OrderNumber”).toString.Trim)
1 Like
its the if condition syntax that is wrong. This worked. Thank you. Appreciate your quick help.
(String.IsNullOrWhiteSpace(row(“OrderNumber”).ToString.Trim)) and (row(“InvoiceNumber”).ToString.contains(“-”))
Thank you,
pari
system
(system)
Closed
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.