Skip to main content
New Participant
Oct 11, 2021 4:11 PM UTC
Question

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?

    2 replies

    csteward
    Brainy
    Oct 11, 2021 5:29 PM UTC

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

    New Participant
    Oct 11, 2021 5:34 PM UTC

    thank you I will check what you tell me