A developer created a landing page in CloudPages which return unique content when subscriber data is located on a related data extension. The developer does not know if all subscribers have rows in the related data extension, and want default content to render if no subscriber data is found on the related data extension. Which best practice should the developer follow to control the unique and default content?
To control the rendering of unique and default content based on the presence of subscriber data in a related data extension, the best practice is to use the RowCount function and an IF statement:
%%[ VAR @rowCount SET @rowCount = RowCount(LookupRows('RelatedDataExtension', 'SubscriberKey', _subscriberKey)) IF @rowCount > 0 THEN /* Render unique content */ ELSE /* Render default content */ ENDIF ]%%
This approach checks if there are any rows in the related data extension for the subscriber and conditionally renders the appropriate content.
AMPscript Guide
Salesforce Marketing Cloud Documentation
Effie
7 days agoMarti
13 days agoSheldon
18 days agoKara
23 days agoKathryn
28 days agoBrice
1 month agoLayla
1 month agoNieves
1 month agoNichelle
2 months agoViola
2 months agoTijuana
2 months agoNohemi
2 months agoJeff
2 months agoVirgina
2 months ago