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
Verona
29 days agoRasheeda
1 month agoViva
1 month agoVerona
2 months agoRasheeda
2 months agoViva
2 months agoEna
2 months agoNell
2 months agoJanessa
2 months agoPilar
3 months agoTula
3 months agoEffie
3 months agoMarti
4 months agoSheldon
4 months agoKara
4 months agoKathryn
4 months agoBrice
4 months agoLayla
5 months agoNieves
5 months agoNichelle
5 months agoViola
5 months agoTijuana
5 months agoJesusita
24 days agoNohemi
5 months agoJeff
6 months agoVirgina
6 months ago