1

I'm using a BuildRowsetFromString function and while it shows the correct data when there are values, or if a record is not in the dataset, if a record appears with blank data I can't get anything to display.

Here's what I've tried:

%%[

SET @rowset = LookupOrderedRows("Recently-Browsed",1,"Add Date Desc","EmailAddress", EmailAddr)

IF RowCount(@rowset) == 0 THEN
        SET @browsing = "Not Found"

ELSE RowCount(@rowset) > 0 THEN
        SET @browsing = FIELD(ROW(@rowset, 1), "Product Categories Viewed - Top")
ENDIF
]%%

%%[
SET @CategoryRows = BuildRowsetFromString(@browsing,"|")
  FOR @i = 1 TO RowCount(@CategoryRows) DO

SET @CategoryRow = Row(@CategoryRows,@i)
SET @Category = Field(@CategoryRow,1)
]%%


%%[NEXT @i]%%

and then:

%%[

IF @category == "" THEN
     SET @browsing = "Null Row"
ELSE SET @browsing = @category

ENDIF]%%

%%=v(@browsing)=%%

if @category is null, it still shows a blank, and not "Null Row" as expected.

What am I missing here?

Thanks!

1

You should consider the EMPTY() function, which checks for both NULL and empty string.

0
0

I'm no Ampscript expert, but I think the IsNull function might help you out here...

%%[

IF @category == "" OR IsNUll(@category) THEN
     SET @browsing = "Null Row"
ELSE SET @browsing = @category

ENDIF]%%

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.