Skip to main content
Known Participant
Jun 14, 2023 8:09 PM UTC
Question

Error in Process model

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

    Known Participant
    Jun 14, 2023 8:10 PM UTC

    This is the error for above code

    harshitb6843
    Brainy
    Jun 15, 2023 5:39 AM UTC

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

    mathieud0001
    Genius
    Jun 14, 2023 8:57 PM UTC

    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.