Occasional Microsoft JScript runtime error: 'sArray.1' is null or not an object

I get an occasional Microsoft JScript runtime error: ‘sArray.1’ is null or not an object.
The process will be looping through a file and extracting the various bits, but then will fail.
Once it fails it seems to fail on all subsequent lines.
When a new file is picked up then it is okay once again.

Not sure why it works most of the time, but fails on larger files with more lines.
Wondering if line 10 is not happening for some reason, so the array is empty.

Added in a log entry to verify on the next occurrence.

Add logging for

  • sArray[0]
  • sArray[1]
  • sArray[2]
  • sArray[3]

and in your example of the logs, we dont see the content of sPayrollFileName

I was not logging sPayrollFileName, so I added it.
Also added logging the array values.

image

I checked the Connect logs and there were no errors in them for the same day or time period.
When we receive these files we are also processing a couple hundred files and some are quite large files.

Seems to error at the same row.

image

Could there a limit on the number of rows that can be processed this way with the loop and extracting values with Enhanced JScript?

I think that the error is pretty clear. You are trying to slice the content of an array cell that doesn’t exist, hence the NULL error.

Next step is to figure out why you have nothing in the variable sPayrollFileName at one point. Once you figure that out, you will be one step closer to the solution.

I believe that I figured it out.
The emulation was set to 66, I increased it to 5000 which should be much more that ever needed.
The first 2 tests worked fine, but am going to try a much larger file.

I passed a file with over 1k and it worked perfectly.

Thanks

I am happy that it works now
:ok_hand:

@UomoDelGhiaccio: instead of looping through the entire file line by line, you could also use a splitter on each line. That way, you’d always get your information from the first line of each chunk and you wouldn’t have to worry about the number of lines in your emulation settings.