Most scenarios, it needs to be fetch the data from DE. You can achieve this using SSJS or AMPScript.
Find below AMPScript code snippet to retrieve the FirstName and LastName from TEST DE.
You can use this in Email or Cloudpage.
%%[ SET @rowset = LookupRows("TEST DE","FirstName",FirstName,"LastName",LastName) SET @row = Row(@rowset, 1) SET @FirstName = Field(@row, "FirstName") SET @LastName = FIELD(@row, "LastName") if @FirstName == "XYZ" then output(v(@LastName)) else output(v(@FirstName)) Endif ]%%