Skip to main content
October 11, 2021
Question

split and index

  • October 11, 2021
  • 2 replies
  • 0 views

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?

    2 replies

    csteward
    October 11, 2021

    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 :)

    October 11, 2021

    thank you I will check what you tell me