A field value returned from a DE lookupcontains a tab-delimited list of values. Which AMPscript function could easily determine if a specific text string exist anywhere in the list?
To determine if a specific text string exists in a tab-delimited list of values, the BuildRowSetFromString AMPscript function is the most appropriate. This function splits the string into a rowset, making it easier to search for the specific text.
BuildRowSetFromString Function: This function converts a delimited string into a rowset, which can then be iterated over or searched using other AMPscript functions.
SET @values = "val1\tval2\tval3" SET @rowset = BuildRowSetFromString(@values, "\t") SET @rowCount = RowCount(@rowset) SET @found = "false" FOR @i = 1 TO @rowCount DO SET @row = Row(@rowset, @i) SET @value = Field(@row, 1) IF @value == "specificText" THEN SET @found = "true" /* exit the loop if found */ BREAK ENDIF NEXT @i
[: Salesforce AMPscript Function Reference, , ]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit