Something like this should work for numbered data extension columns in your sending audience:
for @i = 1 to 42 do
set @station = AttributeValue(concat("station",@i))
if not empty(@station) then
<li>Station %%=v(@i)=%%, %%=v(@station)=%%</li>
The problem is, that you are directly closing the IF-block after you open it. Therefore it doesn't have any effect.
You currently have the following:
IF not empty(@PostName_2) then
[YOUR CONDITIONAL HTML CODE]
Instead you should close the IF using the ENDIF-keyword after your conditional html code:
IF not empty(@PostName_2) then
I suspect, not having your complete Ampscript, the issue is caused by you not selecting a single row, but applying Field function to multiple rows. Here is what you need to do:
SET @rowCount = rowcount(@CampTypeRows) /* count rows to ensure your lookup returns something */
IF @rowCount > 0 THEN /* only execute this block if you have some results */
Lookup function is used to pull a specific field from a specific row in a specific DE. Basically it is the combination of LookupRows() > Row() > Field() functions.
LookupOrderedRows function is used to grab a specific amount of rows from a data extension (or similar object - Data View, Mobile List, etc.). In order to grab a value from this rowset you would ...
Lookup returns a single column value from a single row.
NOTE: If the name/value pairs you're using in the Lookup function match more than one row in the Data Extension, a single column's value is still returned. The row chosen for the return value cannot be specified and should be not considered consistent.
The LookupOrderedRows and LookupRows functions ...
member_busname is the Enterprise Business Name, not the name of the BU which is why it's all the same across the child BUs. The BU name is not available as a personalization string. There are SOAP objects that could be useful ("BusinessUnit", "Account"), but I don't think they are retrievable from the child BUs. You could use the memberid and an IF statement ...
No, unless the HTML is contained in a content block or a data extension column value. If it were, then you could utilize the AMPscript string functions on it -- functions like Replace, IndexOf, BuildRowSetFromString, etc.
AMPscript is a server-side language. Its functions are compiled/evaluated before the email is sent. It's similar to PHP and not client-...
This is unfortunately not possible, as there is no personalization string holding the value of the cloud page name. My best suggestion will be either pass it in CloudPagesURL, from an ampscript variable - or to use link alias instead:
<a href="https://www.salesforce.com" alias="Make This Unique">SFMC</a>
You will be able to pass it on in your ...
Unless there is an API/FTP integration in place, Marketing Cloud has no way of knowing whether or not a code has been redeemed. This is an issue a lot of SFMC users are facing, as it is very much dependent on the e-commerce application and it's ability to report on redeemed vouchers. If at all possible, for many clients only a manual process of uploading CSV ...
Unfortunately not. In fact, it's not even possible to retrieve the data source name from an email (using _DataSourceName system string), as it will return 'All Subscribers' as the value. I've exhausted all options, including retrieving the Journey configuration payload from the REST API, but you won't find it in there either.
The only solution would be to ...
I reviewed this with @kiran on a webinar.
He is now storing the Page URL of the CloudPage in a 'Landing Page Details' DE with the page name.
You can use this URL value to lookup the page name from the DE. In order to do this, you need to strip the query string parameters from the PAGEURL which I have done by locating the ? position using AMPscript IndexOf ...
You can't get the actual landing page name, but you can retrieve the page URL along with any URL parameters using the personalization string PAGEURL. For example, set the following variable on your landing page:
set @pageURL = RequestParameter("PAGEURL")
You'll need to use CloudPagesURL in the email to the landing page to pass the parameters to the CloudPage.
<a href="%%=RedirectTo(CloudPagesURL(1234))=%%" alias="Link">Link to landing page</a>
CloudPagesURL will pass the _subscriberkey, jobID, and memberid used in your AttributeValue function.
We're missing the server side code that does your triggered send etc, but with respect to the tutorial you mention, the last code snippet in the examples is where you get the URL of the uploaded asset...
var createAsset = HTTP.Post(requestUrl, contentType, Stringify(jsonBody), headerNames, headerValues);
The createAsset response returned by the API ...
Since AMPscript is a server-side language, you can only do the following:
%%[ IF @MY_VAR == "True" THEN ]%%
%%[ ENDIF ]%%
Otherwise, here is another technique to think about:
SET @MY_VAR = "hidden"
var spans = document.querySelectorAll(".red");
for(var i = 0; i < spans.length; i++...
As @EazyE stated in his comment, your solution is to utilize the SSJS Core library in order to return 'real time' row counts.
Utilizing any of the AMPscript or SSJS Platform functions, will return as you showed above. This is due to the way these are processed (now, admittedly, I am working off of assumptions and guesses, so I COULD be wrong, but I am ...
You can use the Smart Capture feature to create forms in a really user-friendly way, selecting the Data Extension where you want to store the record after each submission.
I believe the problem comes from RetrieveSalesforceObjects and Field functions.
Once you've provided the name of your object on the first parameter of the function, there is no need to prefix the other columns names with it. Try this:
SET @locationRows = RetrieveSalesforceObjects(
"Id", "=", @Id
The same thing applies ...
Correct, it's a fairly basic usecase that you're trying to implement.
If you are trying to retrieve just one specific value, say Product Name, you can use just LookUp function with the following script:
var @CustomerOrder, @Product
set @CustomerOrder = AttributeValue("OrderId")
set @Product = LookUp("ShoppingCart","Product Name","OrderId", @...
I don't think you can use SSJS try / catch in Emails, I would anyway leave SSJS out of emails in general.
There is RaiseError in AMPScript, but that doesn't really give you access to an error message from the Retrieve call.
The only workaround I know is to verify your code on a cloudpage and just wrap it in a try catch there. The errors you get from the SF ...
This is correct, you will need to fire an entry event through API and the easiest way to do this is using SSJS. To send events using the API:
Define the event and its properties (If defining the event in Marketing Cloud, make note of the Event Definition Key for API)
Use a valid OAuth access token to authorize requests to the Marketing Cloud REST APIs.
I am honestly not sure why you are doing things that way. Seems like a ton of extra work for a simple output.
So the issue is likely coming from that you have the 2 % next to each other which is triggering the AMPscript renderer to look and try to see if its a var/function/personalization string. This combined with the layers of rendering required for the ...
I'd recommend logging an unsub event instead of toggling the status. Logging unsub events ensures that all of the tracking data relating to the subscriber is recorded properly. The system personalization strings in the send context will ensure your page has all of the necessary info. This method also supports the unsubscribe granularity if your send is ...