2

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")
3
  • Please post your code and we'll have a look.
    – Timothy
    Commented Aug 11, 2014 at 18:21
  • @Timothy I updated my post above with the code from our email
    – Realrx7
    Commented Aug 11, 2014 at 19:03
  • @Timothy the error is coming from where we set the rowcount. See updated code above.
    – Realrx7
    Commented Aug 12, 2014 at 18:17

1 Answer 1

2

Error: The initial end count value for the loop count not be cast as an integer.


Change your code to the below, see it if helps. Specifically, the ROWCOUNT value is being added to 0 in order to make sure the variable is viewed as an integer, and not a text value.

Set @family_id = FamilyID

Set @GroupRecord = LookupOrderedRows(@DELookUp,0,"AppointmentDateTime DESC","FamilyID",@family_id)

Set @row_validation = RowCount(@GroupRecord)

If @row_validation < 1 THEN

RaiseError("No values for this subscriber.",true)

ELSE

Set @totalCount = @row_validation
Set @totalCount = Add(@totalCount,0)

ENDIF

For @i = 1 to @totalCount do

Set @PatientSubKey = Field(@row,"Subscriber Key")
Set @PatientFirstName = Propercase(Field(@row,"PatientFirstName"))
Set @PatientLastName = Field(@row,"PatientLastName")
Set @PatientAppt = Field(@row,"AppointmentID")
Set @PatientApptTime = Field(@row,"AppointmentDateTime")
Set @PatientApptDay = Format(@PatientApptTime,"dddd, MMM, d, hh, mm, tt")

NEXT @i

2
  • We still receive the same error with the adjusted code above
    – Realrx7
    Commented Aug 11, 2014 at 20:15
  • Is the value of @DELookUp being assigned? I don't see it in the code. Commented Aug 11, 2014 at 21:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .