Level 3 Assignment 1 error: "Assign TransactionItem: Index was outside the bounds of the array."

Everything runs fine until this. Not sure what is happening. Attached is a screenshot.

The index is from 0. If you want the first item, you should assign in_WIList(0).

Last item of that array could be express as in_WIList(in_WIList.Count - 1) for example

Thanks, so what can I change to correct this?

@msan

@jlev11 Change the Condition in if Activity to this :
in_TransactionNumber < in_WList.Count

@jlev11

out_TransactionItem = in_WIList(in_TransactionNumber - 1)

First item index is 0. If you just change the condition:

  • Your first item will be in_WIList(1), skipping the actual first item
  • You’ll process one item less than expected

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.