Skip to main content
June 14, 2023
Question

Error in Process model

  • June 14, 2023
  • 3 replies
  • 0 views

Hi All for the attached code it is showing the error attached. The attached code will saved into "Country " variable  Of type textCould you please help me

rule!ISR_er_displayCountryNameById(
  countryId: index(
    rule!ISR_qry_GetAddressInfo(
      type: cons!ISR_REF_CODE_ADDRESS_TYPE_PRIMARY_RESEARCHER,
      typeId: index(
        rule!ISR_qry_GetPersonDetailsbyStudyRequestId(
          studyRequestId: pv!studyRequest.studyRequestId,
          
        ).data,
        "studyPnId",
        null
      )
    ).data,
    "countryId",
    {}
  )
)

    3 replies

    June 14, 2023

    This is the error for above code

    harshitb6843
    June 15, 2023

    The error itself is very clear. When you have already used index() function, why not put the data in it too?

    mathieud0001
    Brainy
    June 14, 2023

    One of the queries is returning a null and .data is not resolving to anything.

    You can either fix the queries to force it to return a datasubset (even if empty) or you can check for nulls in this expression and adjust behaviour accordingly.

    That being said, nesting queries like this is not a best practice. With Record Types (with the appropriate relations), this type of query would be much cleaner.