How to extra data from my example string?

how do I get the original invoice date using string operations.

Original Invoice No:00000/000000000 Invoice No: 00000/0000000000
Original invoice date:26nov2018
11:38 AM Invoice Date: 03­Dec­2018
10:43 AM
Bill to
Passenger: MR. xxxxxxx xxxxxxxxx
SAC Non Taxable /
IGST CGST SGST/ UTGST

1 Like

Fine
if this string is in a varaible of string type
intext = “Original Invoice No:00000/000000000 Invoice No: 00000/0000000000
Original invoice date:26nov2018
11:38 AM Invoice Date: 03­Dec­2018
10:43 AM
Bill to
Passenger: MR. xxxxxxx xxxxxxxxx
SAC Non Taxable /
IGST CGST SGST/ UTGST”

then
outtext = intext.Split(Environment.Newline.ToArray())
where outtext is a string array variable
–now use a for each loop and pass the above variable as input and change the type argument as string in the property panel of for each loop
–inside the loop use a if condition like
item.Contains(“Original invoice date”)
if the condition passes it will go to THEN part where use a assign activity like
out_date_str = Split(item,":")(1).ToString.Trim
where out_date_str is a string variable holding the value of original invoice date

hope this would help you
Cheers @shilpa1

You can use Regex Matches activity for those.
Regex for first one “(?<=Original Invoice No:).*(?=Invoice No:)”
Regex for second one “(?<=Invoice Date:).*”

I got the result but I don’t want to loop it again, but it is looping multiple times

2 Likes

im not using the single file hear I using the directory so what variable should I pass to the matches input variable

1 Like

MatchesExample.xaml (5.3 KB)

Here is an example

image
try this

very simple
add a BREAK activity in the THEN part next to this step

so that it wont loop again

Cheers @shilpa1

I’m using get text activity in that im getting the that text which I have sent earlier in message box, so from that I need only orginal invoice date in message box.

so did that work buddy

Cheers @shilpa1

how do I get invoice date here…

these steps @shilpa1

for the date 26nov2018 I need to get the date in the format November,2018

1 Like

alright
once getting out_datestr from this step

use a assign activity like this
out_datestr = Datetime.ParseExact(out_datestr,“ddMMMyyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MMMM,yyyy”)

where the output value of out_datestr would be November,2018

Cheers @shilpa1

how do I get the invoice date here…?

Original Invoice No:00000/000000000 Invoice No: 00000/0000000000
Original Invoice Date:26­Nov­2018
11:38 AM Invoice Date:03­Dec­2018
10:43 AM
Bill to
Passenger: MR. ARINDAM MUKHERJEE
PNR: cccccc Sector: Gangtok ­ Kolkata
IGST CGST SGST/ UTGST

Text_extraction.zip (11.3 KB)

try this XAML

image
Hope that helps

how di I get the PNR, INVOICE DATE, HSTIN/ UIN OF Customer, place of supply

Original Invoice No:00000/0000000000 Invoice No: 000000/0000000000
Original Invoice Date:26­Nov­2018
11:38 AM Invoice Date: 03­Dec­2018
10:43 AM
Bill to
Passenger: MR. ARINDAM MUKHERJEE
PNR: z8zz3Z Sector: Gangtok ­ Kolkata
GSTIN / UIN of Customer: 06AAACM0829Q1Z8 Place of Supply: Haryana

i’m getting error like “string was nor regcognised as valid date Time”

1 Like

Can I have a view on the expression passed
Cheers @shilpa1

Datetime.ParseExact(invoicedate,“ddMMMyyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MMMM,yyyy”)

for the date 30dec2018

1 Like