I have an issue to understand the else if statement, so basically if city is empty I want it to show: no rows found, I tried to add: %%[ if @rowCount > 1, from my understanding if there's city, then it shows the list, but if it's 0, it would show: No rows found
However, instead of showing: No rows found, it's still showing the person list eventhough the city is empty.
My question, when city is blank or there's no city, how to replace it with: No rows found?
%%[ set @city = AttributeValue("MailingCity") set @rows = LookupRows("TEST DE","TestCity", @city) set @rowCount = rowcount(@rows) ]%% %%[ if @rowCount > 0 then for @i = 1 to @rowCount do set @row = row(@rows, @i) /* get row based on counter */ set @Name = field(@row,"FirstName") set @TestCity = field(@row,"TestCity") ]%% %%=v(@i)=%% %%=v(@Name)=%% %%=v(@TestCity)=%% %%[ next @i ]%% %%[ else ]%% No rows found %%[ endif ]%%
Best Answer
So I think the issue you are running into is that you have null values in your TestCity field in the TEST DE data extension. This means that when you do the lookupRows to a null value (e.g. MailingCity is empty/null) then it returns those rows that have null from your DE.
This is likely why you are getting a false positive result and it is returning a rowcount. Something like the below should remove this issue.