3.1.2.2.1.1 hash (Hash Code for Record)

This element specifies the unique hash value of a given record within the specified external data source. This element is used to maintain a relationship between the records within an external data source and a given source WordprocessingML document.

The contents of this element's val attribute shall be a hash value that will uniquely identify the record in the external data source.  The hash value for a record is computed using the following algorithm:

Utility function 1:

#define nPrimeLast 4294967291

__int32 LHashMM( __int32 l, __int32 dl )

{

        l = 131 * l + dl;

        if (l >= nPrimeLast) {

                l -= nPrimeLast;

        }

        return l;

}

Utility function 2:

__int32 LGetHashWz(const WCHAR *wzText)

{

        int cch = lstrlen(wzText);

        __int32 lhash = 0L;

        for (int i = 0; i < cch; i++) {

                lhash = LHashMM(lhash, wzText[i]);

        }

        return lhash;

}

Hash Algorithm:

__int32 lwHash = 0L;

for(int i = 0; i < TotalNumberOfColumnsInTheDataSource; i++) {

        Retrieve the value in the i-th column of this record as a Unicode String wzData;

        __int32 l = LGetHashWz(wzData);

        if(l) {

                lwHash = LHashMM(lwHash, l);

        }

}

return lwHash as the computed hash for this record;

[Note: This information is necessary as part of a mail merge because records may be added or deleted from external data sources, and a means must be provided to maintain record-specific inclusion or exclusion data using the active element (§3.1.2.1.1.6, active) and the affected external data record when the WordprocessingML document is reconnected to the external data source irrespective of the ordering of the records within the external data source. end note]

[Example: Consider the following WordprocessingML fragment for the information about a single record in a source document for a mail merge:

 <w:recipientData>
   <w:active w:val="0" />
   <w:hash w:val="258865469" /> 
 </w:recipientData>

The external data record associated with this information is specified via the hash value 258865469. This record will not be imported into the merged WordprocessingML document because the active element (§3.1.2.1.1.6, active) associated with the given external data record has a val attribute equal to 0; for example, when the specified external data source is connected, the record that has the hash value 258865469 will not be used to populate mapped fields in a merged document with data from that record. end example]

Parent Elements

recipientData3.1.2.2.1.2, recipientData)

Attributes

Description

val ()

The possible values for this attribute are defined by the ST_DecimalNumber simple type (§3.1.2.3.1, ST_DecimalNumber).

The following XML Schema fragment defines the contents of this element:

 <complexType name="CT_DecimalNumber">
   <attribute name="val" type="ST_DecimalNumber" use="required"/>
 </complexType>
Show: