1

WHERE ISSUE OCCURS The loop and rowcount function get the rows of the returned data set. If no rows are returned for the FamilyID this will mean that the loop will not run and the @rows variable is only set if the loop runs.

The final set statement: Set @PatientSubKey = Field(@row,"Subscriber Key") exists outside of the mentioned loop below. So if the mentioned loop does not run, the @row variable will not be set, meaning that this function will fail because it is doing a lookup on an @row variable that was never set (null value). How can we set this to be a null value?

   Set @GroupRecords = LookupOrderedRows(@DELookUp,0,"AppointmentDateTime","FamilyID",@familyid)

   If not empty(@GroupRecords) then
      for @i = 1 to Rowcount(@GroupRecords) do 

    Set @row = Row(@GroupRecords,@i)

    Set @FamilyAppt = Field(@row,"AppointmentID")
    Set @ApptSubscriberKey = Field(@row,"Subscriber Key")
    Set @PatientID = Field(@row,"Subscriber Key")
0

Declaring @row outside of the loop without initializing with a SET will make it null.

VAR @row
Set @GroupRecords = LookupOrderedRows(@DELookUp,0,"AppointmentDateTime","FamilyID", ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.