1

i am trying to show meeting details of a record on

Condition-1 meetingtype is "on"

Condition-2 if assignedsaleofficecode is empty then look for saleofficecode

this is the dataextension link https://docs.google.com/spreadsheets/d/1siITSm6wADg_DJ66xjSb-NVIBcdsU6zuru8vMxZgtlY/edit?usp=sharing

Below code works correctly for 1st record but for 2nd record its not working(showing meetings of 1st records).where 2nd records meeting type is "off" so it should show content-2 which is in else part. please suggest where this mistake in my code.

 %%[

                    /* retrieve values */
                    set @SO = AttributeValue("SalesOffice")
                    set @AO = AttributeValue("Assignedsaleoffice")



                    if Empty(@AO) then
                    set @ovalue= @SO
                    SET @rs = LookupOrderedRows("simpletest",5,"MeetingDate Asc","SalesOffice",@ovalue,"MeetingType","on")
                    else
                    set @ovalue= @AO
                    Set @rs = LookupOrderedRows("simpletest",5,"MeetingDate Asc","Assignedsaleoffice",@ovalue,"MeetingType","on") 
                    Endif 
                    set @rowCount = rowcount(@rs)
                    if @rowCount > 0 then
                    for @i = 1 to @rowCount do
                    var @meetingDate, @MeetingID, @MeetingURL
                    SET @row = Row(@rs,@i)
                    SET @meetingDate = field(@row,"MeetingDate")
                    SET @MeetingID = field(@row,"MeetingID")
                    infomeetingId=',@MeetingID)
                    if (@meetingDate > Now()) Then
                    ]%%

                    <b>%%=Field(@row,"Program")=%%</b>
                    <b>%%=Format(@meetingDate,"MM/dd/yyyy")=%%</b>
                    <b>%%=Field(@row,"MeetingStartTime")=%%</b>
                    <b>%%=Field(@row,"MeetingType")=%%</b>
                    <b>%%=Field(@row,"FirstName")=%%</b>
            %%[
                    endif
                    next @i
            ]%%

 %%[
else
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tbody>
            <tr>
                <td>
         Content-2
                </td>
            </tr>
        </tbody>
        </table>
endif
]%%
0

When assignedsaleofficecode is empty, you are just looking up on records with SalesOffice and Meeting type, but this will also give records with assignedsaleofficecode empty.

So you need to add "assignedsaleofficecode" to your filter in your first lookup. try this

if Empty(@AO) then
                set @ovalue= @SO
                SET @rs = LookupOrderedRows("simpletest",5,"MeetingDate Asc","SalesOffice",@ovalue,"MeetingType","on","Assignedsaleoffice","")
                else
                set @ovalue= @AO
                Set @rs = LookupOrderedRows("simpletest",5,"MeetingDate Asc","Assignedsaleoffice",@ovalue,"MeetingType","on") 
                Endif 
  • @Ranjith Kumar Haridas, is the solution working now? If yes please upvote or mark as answer. – Praveen Kumar Bandi Sep 18 '17 at 9:31

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.