« first day  last day (15 days later) » 

12:04 PM
Good morning Kelly. Let me know when you are available today. Thanks
 
 
1 hour later…
1:06 PM
hey there - let me know if you have some time, we can take a look
it may be helpful to just hop on a call and get you resolved that way as well - let me know what works
 
Hello
Need to leave this window up so i dont miss ya
 
heh - yeah - no notice on it
so a couple things
the portion If @i == 1 THEN
Set @FamilyFirstNames = Propercase(Field(@row,"PatientFirstName"))
that essentially sets those variable on the first record
 
so are all of the appt times etc the exact same thing?
and only Set @FamilyAppt = Field(@row,"AppointmentID")
Set @ApptSubscriberKey = Field(@row,"Subscriber Key")
Set @PatientID = Field(@row,"Subscriber Key") are supposed to be unique?
 
the appointment times should be different. In the email it shows multiple appointments at a single time and allows them to confirm all of them with one call to action
Yes supposed to be unique
Subscriber = Patient ID
 
1:15 PM
your data is being set here
If @i == 1 THEN
Set @FamilyFirstNames = Propercase(Field(@row,"PatientFirstName"))
Set @FamilyApptTime = Field(@row,"AppointmentDateTime")
Set @FamilyApptDay = Format(@FamilyApptTime,"dddd")
Set @FamilyApptMonth = Format(@FamilyApptTime,"MMM")
Set @FamilyApptDate = Format(@FamilyApptTime,"dd")
Set @StartTime = Format(@FamilyApptTime,"h:mm tt")
Set @ApptDisplay = Concat(@FamilyApptDay,", ",@FamilyApptMonth," ",@FamilyApptDate," at ",@StartTime,"")
Set @SubjectLineDate = Concat(Format(@FamilyApptTime,"MMMM"),' ',Replace(@FamilyApptDate,"0",""),'')
 
Correct
 
but only on the first time
so if there are three rows, it will take the first rows data, and use it all three times
 
Tbats what we are seeing now in our data extension
 
try removing that if statment
that should get you each row's data
also make sure to change "next" to "next @i"
 
Ok let me do that now and run a quick test. only will take a minute
 
1:18 PM
I'm not sure if that makes a difference, but it might
ok - ill be back in a second - need coffee :)
 
thanks
The change of next to next @i, are you referring to the set or the upsert?
 
hang on - there is a lot more code... :/
 
ok, what is the top ampscript vs next ampscript doing?
sorry - i was only looking at the top section - my bad
 
no problem
 
1:26 PM
you also have the same code multiple times it looks like
 
are you referring to the multiple ways i tried to get the confirmation insert working?
 
yeah
so let's start at the top - was that something you built?
or already there
 
it was already there
 
ok - so it's already setting variables for you
 
1:32 PM
ok - so the top portion gets you all set up - let me look at the middle portion
and the primary key of - LL_TEST_ET_Appointment_Action is?
 
We don't have a primary key because it would only let us insert a single record when we did
It would be AppointmentID
 
ok - that's what I was mentioning yesterday - you had just appt ID?
 
yeah - so it would need to be more than one column to make up the key - apptid and patientid
that should be unique
 
there is both appointmentid and patientid in the DE
 
1:36 PM
I assume this table should be add only, and never an update?
 
it can be an update
 
right - they both would need to be checked as primary key
 
they get multiple confirmations so they can confirm more than once
ok
 
they are confirming the appt by patient?
 
Yes. each patients appointment is shown in the email with a sinlge confirmation button
 
1:38 PM
would a patient ever duplicate an apptointmentID?
 
they shouldnt
each appointmentid should be distinct
 
gotcha
so apptID should be distinct enough on its on
 
yes
So we wouldnt need multiple primary key
s
 
nope - im also trying to understand :)
did you add all the ampscript in the middle section, or was something else already there?
 
This was all there was at first
%%[
SET @ActionType = "Confirm"
INSERTDE(
    "ET_Appointment_Action",
    "AppointmentID",@FamilyAppt,
    "FamilyId",@familyid,
    "PatientID",@PatientID,
    "AppointmentDateTime",@FamilyApptTime,
    "AppointmentClinicID",@ApptClinicID,
    "ActionDateTime",@ActionDateTime,
    "ActionType",@ActionType,
    "Campaign_Name",@CampaignName,
    "Send_id",@JobId,
    "EventDate", RequestParameter('ed')
   )
   ]%%
 
1:45 PM
ok
is all of this different per appointmentid?
Set @FamilyFirstNames = Propercase(Field(@row,"PatientFirstName"))
Set @FamilyApptTime = Field(@row,"AppointmentDateTime")
Set @FamilyApptDay = Format(@FamilyApptTime,"dddd")
Set @FamilyApptMonth = Format(@FamilyApptTime,"MMM")
Set @FamilyApptDate = Format(@FamilyApptTime,"dd")
Set @StartTime = Format(@FamilyApptTime,"h:mm tt")
Set @ApptDisplay = Concat(@FamilyApptDay,", ",@FamilyApptMonth," ",@FamilyApptDate," at ",@StartTime,"")
Set @SubjectLineDate = Concat(Format(@FamilyApptTime,"MMMM"),' ',Replace(@FamilyApptDate,"0",""),'')
 
Yes, unless it is the same patient in which the first anme would stay the same
 
but each row in the lookup table has all of that, correct?
 
sorry for so many question - i think i have it
last question ( i think) did this ever work?
 
no problem i was just as lost
no it never worked
 
1:48 PM
ok
save a copy somewhere, cause we are going to change it a bit
copy/paste locally
 
already have a copy created
 
not touching the original lol
 
first thing - copy the insertde function above into the top ampscript block, just under the ENDIF but before the NEXT
 
1:51 PM
now delete all of the ampscript in the middle of the page
fwiw - you can after this go back and reduce the html on the page as well
but do that after you get this working :)
 
so there should be in the middle of your page
</body>
</html>

%%[Else]%%

<!DOCTYPE html>
<html lang="en">
<head>
is that right?
I mean - do you have that as well?
 
yes thats what I have
 
ok awesome
lets change this
If @i == 1 THEN
Set @FamilyFirstNames = Propercase(Field(@row,"PatientFirstName"))
Set @FamilyApptTime = Field(@row,"AppointmentDateTime")
Set @FamilyApptDay = Format(@FamilyApptTime,"dddd")
Set @FamilyApptMonth = Format(@FamilyApptTime,"MMM")
Set @FamilyApptDate = Format(@FamilyApptTime,"dd")
Set @StartTime = Format(@FamilyApptTime,"h:mm tt")
Set @ApptDisplay = Concat(@FamilyApptDay,", ",@FamilyApptMonth," ",@FamilyApptDate," at ",@StartTime,"")
Set @SubjectLineDate = Concat(Format(@FamilyApptTime,"MMMM"),' ',Replace(@FamilyApptDate,"0",""),'')
to:
Set @FamilyFirstNames = Propercase(Field(@row,"PatientFirstName"))
Set @FamilyApptTime = Field(@row,"AppointmentDateTime")
Set @FamilyApptDay = Format(@FamilyApptTime,"dddd")
Set @FamilyApptMonth = Format(@FamilyApptTime,"MMM")
Set @FamilyApptDate = Format(@FamilyApptTime,"dd")
Set @StartTime = Format(@FamilyApptTime,"h:mm tt")
Set @ApptDisplay = Concat(@FamilyApptDay,", ",@FamilyApptMonth," ",@FamilyApptDate," at ",@StartTime,"")
Set @SubjectLineDate = Concat(Format(@FamilyApptTime,"MMMM"),' ',Replace(@FamilyApptDate,"0",""),'')
 
remove the if entirely?
 
1:54 PM
removing the if statement - that will give you the individual info for each appointmentid
 
INSERTDE only works in an email message, and not on a landing page
 
I do see you are setting a bunch of variable that aren't actually used on the page - let me make sure im not missing something there
Like - FamilyFirstNames
that's never actually used
more of an fyi than anything
 
ok I will comb through an get those unused variables out
 
1:57 PM
that or actually use them
 
I don't think we will use some of those
 
ok - so they can confirm appointments more than once?
 
yes. they get a 21 day reminder, 10 day reminder, and a 3 day reminder. They can confirm in all 3
 
what if they have already confirmed?
 
dont know why they get all of them regardless of their action but thats how it is setup
they still get one
 
1:58 PM
lol
 
dumb i know
 
that was my first question when looking at this process
 
that will end up with duplicate data in the DE then
so we have to modify
set the primary key in your DE to appointmentID, and we will use upsertdata
 
1:59 PM
sorry for that - we are closer I think
 
no problem. Your help is much appreciated
 
UPSERTDATA(
"ET_Appointment_Action", 1,
"AppointmentID",@FamilyAppt,
"FamilyId",@familyid,
"PatientID",@PatientID,
"AppointmentDateTime",@FamilyApptTime,
"AppointmentClinicID",@ApptClinicID,
"ActionDateTime",@ActionDateTime,
"ActionType",@ActionType,
"Campaign_Name",@CampaignName,
"Send_id",@JobId,
"EventDate", RequestParameter('ed')
)
im hoping after it's done it works :)
so what this will do is the following -
it will check the ET_Appointment_Action data extension for a row that matches @FamilyAppt to AppointmentID column
If that already exists, is will update the data on that row
if it doesn't exist, it will create a new row
 
Sweet!
 
Update/Insert
= Upsert
now make sure the Next is changed to Next @i
altogether it should be
Set @familyid = RequestParameter('fid')
Set @HOHid = RequestParameter('hid')

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

If @FamilyTotal == 1 THEN
Set @Plural = ""
ELSE
Set @Plural = "s"
ENDIF

If Rowcount(@GroupRecords) > 0 THEN

for @i = 1 to Rowcount(@GroupRecords) do

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

Set @FamilyAppt = Field(@row,"AppointmentID")
Set @ApptSubscriberKey = Field(@row,"Subscriber Key")
 
matches up
 
2:04 PM
ok - give that a try
to walk back through it
its grabbing a rowset using the query params
if the rowcount is more than 0, it will loop through the rowset, getting the data from each row, and then updating/inserting a row in the appointment action table
if the row count is 0, then it shows the bottom html (that else in the middle of the page)
 
To confirm
<!-- ET Logic -->
%%[
/* ExactTarget AMPscript */

SET @ActionDate = Now()
SET @ActionDateTime = SystemDateToLocalDate(@ActionDate)

set @Send_id = RequestParameter('jid')
set @JobID = RequestParameter('jid')
set @ListID = listid
set @BatchID = _JobSubscriberBatchID
set @EmailName = emailname_
/*set @EmailAddress = EmailAddress*/

Set @ReminderDate = RequestParameter('rd')

If @ReminderDate == "10" THEN
set @CampaignName = "10 Day Appt Reminder"
set @CampaignID = "100"
Set @DELookUp = "03_ApptConfirmation_Lookup"
 
that looks right to me
not sure if those loops were supposed to do something specific with the page or not
if so - that's doable - just have to move some stuff around
 
They weren't. I jsut put it in there as a placeholder
 
fire that up and let me know if it works
we can somehow figure out how to update the question/answer to reflect this :)
 
Great. Working on it now. Had to change the queries around bc we use this for our 10 day confirmation and 10 days from today is Sunday so the DE is empty. Updating so it looks for 11 days
 
2:12 PM
lol
ok
brb
more coffee :)
 
I feel ya
 
2:26 PM
let me know if you get it working
 
I get this error when I do send preview for the email
Invalid row (parameter 1) passed to Field function. Row is null or empty.
Function: Field(@row,"Subscriber Key")
To test this process I do send preview for the email and then confirm the appointment
 
does the data extension you are retrieving from have subscriber key?
and is it nullable?
 
It has subscriber key and it is set to nullable
 
comment that out for now - you aren't passing it in
 
2:30 PM
wait...
ugh
it can't be nullable - you are using it for the patientID as well
 
ok so we need to update the DE
 
your data will require that to be in there yes
 
bc of this right...
Set @FamilyAppt = Field(@row,"AppointmentID")
Set @ApptSubscriberKey = Field(@row,"Subscriber Key")
Set @PatientID = Field(@row,"Subscriber Key")
 
correct - the ApptSubscriberKey can still go away - you dont use it
plus, the PatientID could be used more than once - no need to look up the same value twice
 
Ok i will remove that an update the DE
 
2:35 PM
if you are flipping a DE from nullable to non-nullable, you may run into trouble
can you clear the data, and reimport?
 
I created a new DE and re-ran the query
to point to the new DE
 
curious how you eneded up with a blank subkey off the query though
 
When I look at the DE it isnt blank so I dont know why the error is thrown
other than it being set as nullable in the DE
 
is it "Subscriber Key"? or SubscriberKey?
 
It is Subscriber Key
 
2:37 PM
strange
 
Ok the preview worked and I click the confirm appt. Let me check to see if the action was recorded in the LL_Test_ET_Appointment_Action table
 
fingers crossed
 
Ok this is eve more weird. The error is being thrown for some of the patients as I scroll through the DE, but not others
Thought it might be because the ones being shown the preview had multiple appointments, but there are instances of both occuring. Single and multi appt
 
sounds like some sort of data issue happening
the DE's are in multiple locations
03_ApptConfirmation_Lookup
nope, just that one
 
The action table is empty also after confirming a couple different appointments
 
2:43 PM
ok - then we need to debug some things
can you grab an hid and fid that you know should work?
and then call the url without going to through the email
 
I dont follow
I can grab an hid/fid that works
 
basically try to by pass the email for now
and call the url with the params on it
whats the landing page url?
basically add &hid=1234&fid=5678 or whatever
lets make sure we know where the issue lies
 
ok - so it doesn't fail, but it doesn't add anything
 
right
 
2:53 PM
in your code,
is it
UPSERTDATA(
"ET_Appointment_Action", 1,
"AppointmentID",@FamilyAppt,
"FamilyId",@familyid,
"PatientID",@PatientID,
"AppointmentDateTime",@FamilyApptTime,
"AppointmentClinicID",@ApptClinicID,
"ActionDateTime",@ActionDateTime,
"ActionType",@ActionType,
"Campaign_Name",@CampaignName,
"Send_id",@JobId,
"EventDate", RequestParameter('ed')
)
or is it
UPSERTDATA(
"SOMETHING ELSE HERE", 1,
"AppointmentID",@FamilyAppt,
"FamilyId",@familyid,
"PatientID",@PatientID,
"AppointmentDateTime",@FamilyApptTime,
"AppointmentClinicID",@ApptClinicID,
"ActionDateTime",@ActionDateTime,
"ActionType",@ActionType,
"Campaign_Name",@CampaignName,
"Send_id",@JobId,
"EventDate", RequestParameter('ed')
)
 
ET_Appointment_Action...palm to face! updating now
to LL_Test...
 
hahaha
awesome
 
ok let me test again
OK the action appears. Let me see if I can find a preview that works with multi appt
It works!!!!
 
hellz yeah!
awesomesauce
go forth and ampscript my friend :)
so here is what we do for the q/a
 
Awesomesauce for all
mostly or you though lol
 
2:59 PM
edit your question and use the code that was from :
Set @familyid = RequestParameter('fid')
to
Next @i
with the if statment, etc
the real issue here was that if statement
add in the original insertde call that was there as well
I will update my answer to have the code we have now
does that make sense?
 
makes sense. thanks again for everything. I can look into the data error because that is most likely in how we are passing the data in
 
yeah - should be unrelated to this
 
one thing, edit my question with the original code?
 
yeah - update your code sample with the original landing page code that had the if statemnt, and the insertDE
you basically had two items - insertde should be upsertdata, and the if statement
 
Ok will do
Updated the q/a
Thanks again so much. Let me know if I updated correctly
 
 
3 hours later…
6:34 PM
Fixed the q/a. I didnt even see your post with the answer
Found out that the issue with the data is where we are setting the inputs in the email
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")
 
6:45 PM
you up and running then?
 
We are working out what is wrong with the data
We've checked the data extension and everyones records are identical (as far as configuration) but it only works for some of the patients
When we remove the code above it wont work for anyone
Could it be the way we are setting the patients info up in the email?
Set @FamilyRecords = LookupOrderedRows(@DELookUp,0,"AppointmentDateTime","FamilyID",@familyid)

for @i = 1 to Rowcount(@FamilyRecords) do

Set @row = Row(@FamilyRecords,@i)
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")
 

« first day  last day (15 days later) »