Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Extensible Markup Language (XML) is a structured document format that defines human- and machine-readable encoding rules.
1
vote
Row Count error
.
%%[
var @xml, @isXML, @nodes, @rowCount
set @xml = AttributeValue("xml")
if indexOf(@xml,"<cart>") > 0 then
set @nodes = BuildRowsetFromXML(@xml,"/cart/items/item",0)
set @rowCount = rowcount … ,concat(@nodepath,"sku"))) > 0 then
set @sku = Field(Row(BuildRowsetFromXML(@xml,concat(@nodepath,"sku"),0),1),'Value')
endif
if rowcount(BuildRowsetFromXML(@xml,concat(@nodepath …
1
vote
How to upload XML data in SFMC?
You can import XML, but you'll need to ensure that the XML blocks are all on one line (stripped of CR and LF).
Also, I mention a little SFMC trick for accommodating large field values in this post. … It's helpful when dealing with big blobs of XML. …
0
votes
Stamp XML as string
As a workaround, I typically do this for XML debugging output:
%%[
var @HTML_XML
set @HTML_XML = AttributeValue("HTML__XML")
set @HTML_XML = replace(replace(@HTML_XML, ">", ">"), "<", "<")
]%% …
2
votes
Why does my AMPscript only loop once?
I'd suggest testing your XPATH in BuildRowSetFromXML using xpather. The path you've specified only returns one result:
You'll need to loop again once you get into the ShipmentClassification node. S …
0
votes
AMPscript loop is showing incorrect output
Why didn't you follow the pattern I outlined in my previous answer? It will produce precisely what you intended -- with just a few minor adjustments:
%%[
var @order_xml, @nodes, @rowCount
set @order …
1
vote
Return null value, if node not present in RSS-feed (ampscript)
Here's my go-to boilerplate for parsing XML. … The conditionals after the @nodepath assignment is the part pertinent to your question:
%%[
var @xml, @isXML, @nodes, @rowCount
set @xml = AttributeValue("xml")
if indexOf(@xml,"<cart>") > 0 then …
1
vote
AMPscript Error with XML
xml version="1.0" encoding="UTF-8"?>')
set @xml = concat(@xml, '<cart>')
set @xml = concat(@xml, ' <items>')
set @xml = concat(@xml, ' <item>')
set @xml = concat(@xml, ' <sku><! … sku=123]]></url>')
set @xml = concat(@xml, ' </item>')
set @xml = concat(@xml, ' <item>')
set @xml = concat(@xml, ' <sku><![CDATA[456]]></sku>')
set @xml = concat(@xml, ' <name><! …
4
votes
Accepted
Using AMPscript to pull XML from DE
sku=789]]></url>
</item>
</items>
</cart>
%%[
/* Sample XML Payload: https://gist.github.com/wvpv/8bec8dc8774fdd1fedb25a69071ac905 */
var @xml, @nodes, @rowCount
set @xml = AttributeValue … ("xml")
if indexOf(@xml,"<cart>") > 0 then
set @nodes = BuildRowsetFromXML(@xml,"/cart/items/item",0)
set @rowCount = rowcount(@nodes)
if @rowCount > 0 then
for @i = 1 to @rowCount do …
1
vote
Parse XML values from a column in the DE?
Here's an abandoned shopping cart example that parses an XML payload.
%%[
var @xml, @isXML, @nodes, @rowCount
set @xml = AttributeValue("xml")
if indexOf(@xml,"<cart>") > 0 then
set @nodes = BuildRowsetFromXML … /items/item[",@i,"]/")
if rowcount(BuildRowsetFromXML(@xml,concat(@nodepath,"sku"))) > 0 then
set @sku = Field(Row(BuildRowsetFromXML(@xml,concat(@nodepath,"sku"),0),1),'Value') …
1
vote
BuildRowSetFromXML with "attribute-id" with multiple data points?
In your XML parsing, I'd definitely check for a match first -- with a rowcount.
Once you have the value, switch to SSJS to parse the JSON. … = Field(Row(BuildRowsetFromXML(@XML, '/custom-attributes/custom-attribute[@attribute-id="dataexample"]',0),1), 'Value')
endif
</script>
<script runat="server" language="javascript">
Platform.Load( …
1
vote
Accepted
Converting a custom xml attribute to a useable AMPscript valuue
0 then
set @entryType = Field(Row(BuildRowsetFromXML(@OrderAsXML, '//order/custom-attributes/custom-attribute[@attribute-id="entryType"]',0),1), 'Value')
endif
]]%
There are several sites for XML …
0
votes
Using AMPScript to pull in RSS feed content in SFMC
@isXML, @nodes, @rowCount
Set @xml = HTTPGet("https://developer.salesforce.com/blogs/feed", false, 0, @CallStatus)
set @xml = Replace(@xml, "dscblog:","")
output(concat("<br>Call Status: ", @CallStatus … ))
if indexOf(@xml,"<channel>") > 0 then
set @nodes = BuildRowsetFromXML(@xml,"/rss/channel/item",0)
set @rowCount = rowcount(@nodes)
output(concat("<br>rowCount: ", @rowCount))
if @rowCount …
2
votes
How to sort line items by OrderLineStatus in XML when AMPScript is looping?
If you only want to show sections with results, then you have to check the rowcount() to determine if a node exists in your XML -- just like you do in all of your other conditionals. … Here's a simple example of the AMPScript side:
%%[
set @xml = AttributeValue("xml")
Set @xslt = GetPortfolioItem("OrderConfirmation")
Set @l = Length(@xslt)
set @regionRowSet = BuildRowSetFromXML …
1
vote
XML and AMPscript -- how do I "BuildRowSetFromString" using data from my API post?
First, you'll need to build a rowset from the XML and iterate through the nodes. Looks like one of the node values will contain the pipe-delimited string. … I added a <part> node in your XML so I could reference it in the BuildRowSetFromXML() function. There may be a simpler way to reference it. …
0
votes
Accepted
RSS feed via Ampscript (with earlier sample code failing)
@xml = HTTPGet("https://lorem-rss.herokuapp.com/feed", false, 0, @CallStatus)
/* strip out invalid elements if needed */
/* set @xml = Replace(@xml, "dscblog:","") */
output(concat("<br>",now(1)))
output … (concat("<br>Call Status: ", @CallStatus))
if indexOf(@xml,"<channel>") > 0 then
set @nodes = BuildRowsetFromXML(@xml,"/rss/channel/item",0)
set @rowCount = rowcount(@nodes)
output(concat("<br …