HsbcStatementParser icon indicating copy to clipboard operation
HsbcStatementParser copied to clipboard

'substr' of null

Open vorg opened this issue 9 years ago • 4 comments

I've been trying to parse some of my statements from 2014 and i'm getting this error

TypeError: Cannot read property 'substr' of null
    at renderers.csv2 (/usr/local/lib/node_modules/hsbc-statement-parser/hsbcextr.js:25:33)

If I console.log the sta variable i see it completely empty

{ filePath: 'json',
  acctNum: null,
  dateFrom: null,
  dateTo: null,
  balFrom: null,
  balTo: null,
  totDebit: null,
  totCredit: null,
  ops: [] }

I'm running the command as following:

./hsbcextr.sh json /Users/name/Dropbox/1412.pdf

vorg avatar Jul 29 '15 14:07 vorg

Hi Marcin,

Thank you for submitting this issue!

Was this the first/only time that you have ever used HsbcStatementParser? What language is your statement file in? (I only tested it on French statement files, so far) Are you able to code?

I look forward to hearing from you!

Adrien

On Wed, Jul 29, 2015 at 4:44 PM, Marcin Ignac [email protected] wrote:

I've been trying to parse some of my statements from 2014 and i'm getting this error

TypeError: Cannot read property 'substr' of null at renderers.csv2 (/usr/local/lib/node_modules/hsbc-statement-parser/hsbcextr.js:25:33)

If I console.log the sta variable i see it completely empty

{ filePath: 'json', acctNum: null, dateFrom: null, dateTo: null, balFrom: null, balTo: null, totDebit: null, totCredit: null, ops: [] }

I'm running the command as following:

./hsbcextr.sh json /Users/name/Dropbox/1412.pdf

— Reply to this email directly or view it on GitHub https://github.com/adrienjoly/HsbcStatementParser/issues/1.

Adrien Joly adrienjoly.com

adrienjoly avatar Jul 30 '15 11:07 adrienjoly

Was this the first/only time that you have ever used HsbcStatementParser?

Yes

What language is your statement file in? (I only tested it on French statement files, so far)

English / UK

Are you able to code?

Yep

vorg avatar Jul 30 '15 14:07 vorg

I think format is completely different. I switched to the code from you usage example now. It's missing the require:

var HsbcStatementParser = require('hsbc-statement-parser/HsbcStatementParser');

But doesn't help. I get can't get[0] of undefined at HsbcStatementParser.js#L29

After fixing it with:

return line ? line[0] : '';

I get error TypeError: Cannot read property 'pop' of null at HsbcStatementParser.js:203:2

vorg avatar Jul 30 '15 14:07 vorg

Hi Marcin,

Unfortunately, your issue is no surprise to me, as I hardcoded the parsing based on French statement files...

The code could be refactored in order to support other languages. If I had to do that I would probably rebuild it upon my latest PDF parsing module: https://github.com/adrienjoly/npm-pdfreader

If you're interested in this project, I can help you on how to use that module, and plug the French-specific module back to a more generic version of HsbcStatementParser.

Best regards,

Adrien Joly

On Thu, Jul 30, 2015 at 4:39 PM, Marcin Ignac [email protected] wrote:

I think format is completely different. I switched to the code from you usage example now. It's missing the require:

var HsbcStatementParser = require('hsbc-statement-parser/HsbcStatementParser');

But doesn't help. I get can't get[0] of undefined at HsbcStatementParser.js#L29 https://github.com/adrienjoly/HsbcStatementParser/blob/master/HsbcStatementParser.js#L29

After fixing it with:

return line ? line[0] : '';

I get error TypeError: Cannot read property 'pop' of null at HsbcStatementParser.js:203:2 https://github.com/adrienjoly/HsbcStatementParser/blob/master/HsbcStatementParser.js#L202

So I think the format is quite different and I won't be able to use it.

— Reply to this email directly or view it on GitHub https://github.com/adrienjoly/HsbcStatementParser/issues/1#issuecomment-126351117 .

Adrien Joly adrienjoly.com

adrienjoly avatar Jul 31 '15 09:07 adrienjoly