There are several differences between updating records and adding new
records. Although all attributes and their associated values available in
INSERT are also available in UPDATE, there are three additional attributes that you can specify, and one additional element. These will be covered in this section. |
||
The first thing that needs to be done when updating is to specify the action
UPDATE instead of INSERT as the value of the AC tag: |
||
strXmlInput = '<?xml version="1.0" ?>\n' + |
||
The first two additional attributes that can be applied to the AC tag with
UPDATE are to check for matching records. To check for matching records use the matchFound and matchNotFound attributes to specify how to handle that record. The default value for matchFound is replaceFields. The default for matchNotFound is acceptRecord (this behaves like INSERT). These attributes are used in tandem with the MatchField element to be covered next. An example of checking for matching records: |
||
<AC matchFound="replaceFields" matchNotFound="acceptRecord">UPDATE</AC>+ |
||
The third additional attribute is to tell WebPublisher PRO how to handle empty
fields in the form. Setting the ignoreEmptyFields attribute will tell
WebPublisher PRO what to do with fields in the form that do not contain a value.
Valid uses of this attribute are Y and N. for example: |
||
<AC matchFound="replaceFields" matchNotFound="acceptRecord" ignoreEmptyFields="Y">UPDATE</AC>+ |
||
For a complete listing of the valid values for these attributes, see references. |
||
In addition to these differences, UPDATE expects an additional element of
MatchField, which will compare the value in your form with the value in the
textbase field. To specify the fields you want to compare. How the record is
handled with after these have been compared are decided by the matchFound and
matchNotFound attributes. This can be added to the function as shown here: |
||
<MatchFields>'+ '<MatchField>FIELDNAME</MatchField> '+ '</MatchFields> '+ |
||
There is an example of this function (buildWpQueryForUpdate() ) in XmlToWpp.ASP. |