Deleting Existing Records with WebPublisher PRO


Copyright © 2006 Inmagic, Inc. All rights reserved.

Deleting records with WebPublisher PRO is similar to updating, except that you need only specify the MatchField and supply its value.
 

First, the function needs to have the AC tag set to DELETE:
 

function buildWpQuery(){

strXmlInput = '<?xml version="1.0" ?>\n' +
'<Query xmlns="http://www.inmagic.com/webpublisher/query">\n' +
'<AC>DELETE</AC>\n' +
'<TN>Cars</TN>\n' +
 

Second, the MatchFields are specified to tell WebPublisher PRO the field that will be used to identify the record to be deleted.
 

'<MatchFields>'+
'<Matchfield>Product-Number</MatchField>'+
'</MatchFields>' +
 

Third, a tag with the field name is used between the Record tags with the value that will identify the record to be deleted. If that value is present in more than one record, all matching records will be deleted. If this is a concern, ensure that you are using a unique field or combination of fields to identify the record to be removed.
 

'<RecordSet>'+
'<Record>'+
'<Product-Number>'AP1045</Product-Number>'+
'</Record>'+
'</Recordset>'+
'</Query>';
 

Lastly, close the query tag and return the string to the calling page or function:
 

return strXmlInput;
}
 

There is an example of this function (buildWpQueryForDelete() ) in XmlToWpp.ASP.

See it in action