Skip to main content
deepaks0008
Known Participant
February 26, 2021
Solved

Illegal Argument Exception invalid index(1) for null value of type PTS_upload?list

  • February 26, 2021
  • 14 replies
  • 0 views

On submit button, I have ri!upload saved with two value [1]- docno:123,ticketNo:444 & [2]- docno:124,ticketNo:3334 

when running process model getting above error? if more input details need to clarify my query please let me know.

    Best answer by peter.lewis

    Are you certain that at this point there are already at least two items in ri!upload? Personally I don't usually create a dynamic number of saves - I try to only perform a single save that updates all the data. Also I strongly distrust square brackets (because if the index doesn't exist it fails), so I usually look for an alternative that doesn't use them.

    If I were doing this I would start with something like this:

    saveInto: a!save(
      target: ri!upload,
      value: a!forEach(
        items: ri!upload,
        expression: a!map(
          id: fv!item.id,
          name: fv!item.name,
          docno: index(
            local!multidocuploadids,
            fv!index,
            null
          )
        )
      )
    )

    Note: I'm not certain if the "items" parameter should be the rule input or the local variable - I can't tell without knowing more context about your interface. Also I used a map for the fields in your rule input, but if it is an explicit type you can use that instead.

    14 replies

    peter.lewis
    Participating Frequently
    February 26, 2021

    Can you show the expression for your interface? Usually I've seen a similar error to this if you're trying to save into a specific index using square brackets. Also what troubleshooting steps have you tried? Usually I remove a little at a time until it fixes the error - then it's a lot easier to solve the problem if you know what caused it.

    deepaks0008
    Known Participant
    February 26, 2021

    1. Inside Button- SaveInto: a!forEach(
    items: local!multidocuploadids, <-- {123,253}
    expression: a!save(ri!upload[fv!index].docno, fv!item) -->[1]docno:123,ticket:22

    -->[2]docno:253,ticket:22
    )

    2. Troubleshoot [i] if(isnull(local!multidocuploadids),{}, above point1 expression) , Trobleshoot[ii] Removed null column named "id"

    peter.lewis
    Participating Frequently
    February 26, 2021

    Are you certain that at this point there are already at least two items in ri!upload? Personally I don't usually create a dynamic number of saves - I try to only perform a single save that updates all the data. Also I strongly distrust square brackets (because if the index doesn't exist it fails), so I usually look for an alternative that doesn't use them.

    If I were doing this I would start with something like this:

    saveInto: a!save(
      target: ri!upload,
      value: a!forEach(
        items: ri!upload,
        expression: a!map(
          id: fv!item.id,
          name: fv!item.name,
          docno: index(
            local!multidocuploadids,
            fv!index,
            null
          )
        )
      )
    )

    Note: I'm not certain if the "items" parameter should be the rule input or the local variable - I can't tell without knowing more context about your interface. Also I used a map for the fields in your rule input, but if it is an explicit type you can use that instead.