split and index

I get the following error expression evaluation error at function 'split' [line 2]: A null parameter has been passed as parameter 1.

local!docOCR: split(
index(
rule!DMX_ScanImagenes(idDocumento: ri!idDocumento).result.responses.textAnnotations.description,
1
),
char(10)
),

how to solve it?

  Discussion posts and replies are publicly visible

Parents
  • You will want to utilize a null check as split() will fail over null values, as you have noticed.  Something like:

    local!docs: rule!DMX_ScanImagenes(idDocumento: ri!idDocumento).result.responses.textAnnotations.description,
    local!docOCR: if(
      isnull(local!docs),
      null,
      split(
        index(
          local!docs,
          1
        ),
        char(10)
      )
    ),

    Also please check out the Insert -> Code feature when posting SAIL snippets, much cleaner :)

Reply
  • You will want to utilize a null check as split() will fail over null values, as you have noticed.  Something like:

    local!docs: rule!DMX_ScanImagenes(idDocumento: ri!idDocumento).result.responses.textAnnotations.description,
    local!docOCR: if(
      isnull(local!docs),
      null,
      split(
        index(
          local!docs,
          1
        ),
        char(10)
      )
    ),

    Also please check out the Insert -> Code feature when posting SAIL snippets, much cleaner :)

Children