WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: MW4 on January 07, 2016, 11:55:25 AM

Title: Strcat adding double quotes strangely
Post by: MW4 on January 07, 2016, 11:55:25 AM
I have code that grabs a VIN number off of an invoice text file and inputs it into an access database.
Sometimes the Vin line is 17 digits and sometimes the line wraps and does 16 on one line and 1 on the next.

I set this code up her to handle that but when it's 17 digits and one line I get 12345678901234567 -- When it's on two lines I get "12345678901234567" It's erroring out because it's counting the double quotes as characters making it a 19 digit data going into a 17 digit field.
 
reads:

if strsub(ItemExtract(InvoiceLine+4, pdfdata, @LF), 1, 3) == "C/C"

Vin         = strsub(ItemExtract(InvoiceLine+3, pdfdata, @LF), 1, 17)

else

Vin16     = strsub(ItemExtract(InvoiceLine+3, pdfdata, @LF), 1, 16)
Vin01     = strsub(ItemExtract(InvoiceLine+4, pdfdata, @LF), 1, 1)
Vin         = strcat(Vin16, Vin01)

endif


I've also tried this line, same result  ------  Vin     = strcat(strsub(ItemExtract(InvoiceLine+3, pdfdata, @LF), 1, 16), strsub(ItemExtract(InvoiceLine+4, pdfdata, @LF), 1, 1))

Why are the double quotes being added only on the Strcat?
Title: Re: Strcat adding double quotes strangely
Post by: stanl on January 07, 2016, 12:10:43 PM
Could you possibly post a sample with the wrap of the 17th digit?
Title: Re: Strcat adding double quotes strangely
Post by: MW4 on January 07, 2016, 12:19:08 PM
2T3WFREVXGW24528

2
Title: Re: Strcat adding double quotes strangely
Post by: MW4 on January 07, 2016, 02:10:23 PM
I fixed it with some strtrim's

Thanks :)