AssociateDDWithFoldDoc

Associates Data Definition With Folder or Document.

Public Function AssociateDDWithFoldDoc(ByVal ObjectId  As Long,

ByVal ObjectType                                                            As String,

ByVal DataDefId                                                              As Long,

ByVal IndexCount                                                            As Long,

ByRef IndexData() As Byte)                                              As Long

 

Parameters

In/out

Name

Data type

Description

In

ObjectId

Long

Object Index (Document Index or Folder Index)

In

ObjectType

String

Object type 'D' for document and 'F' for folders.

In   

DataDefId

Long

Data definition index

In

IndexCount

Long

Index count.

In/Out

IndexData

Byte (TagIndex)

Specifies the byte array for the fields of the dataclass

 

Description

This function call is used to associate Data Definition with Folder or Document.

 

Return value

Name

Description

 1

In case of success

-3

Cabinet not connected.

-2

Invalid operation in read only cabinet.

 

Example

Dim lDocId                        As long

Dim lIndexCount                As Long

Dim mudtFieldInfo()           As TagDataDefField   ‘ conatins field info

Dim btIndexValues()          As Byte

Dim lDDId                         As long

Dim udtIndexValueInfo()     As TagIndex

Dim gPDb                        As PanDb.pdbCls

 

Set gPDb = New PanDb.pdbCls

lDDId = 1 ‘ DataClass Id

lDocId = 100    ‘ Document ID

lIndexCount = UBound(mudtFieldInfo) + 1

'Copy the values into a byte array

ReDim btIndexValues(Len(udtIndexValueInfo(0)) * (UBound(udtIndexValueInfo) + 1) - 1)

For lCount = 0 To UBound(udtIndexValueInfo)

   CopyMemory btIndexValues(lCount * Len(udtIndexValueInfo(0))), udtIndexValueInfo(lCount),                    Len(udtIndexValueInfo(0))

Next lCount

lRetVal = gPDb.AssociateDDWithFoldDoc(lDocId, “D”, IDDId, lIndexCount, btIndexValues)

If lRetVal <> 1 Then

      MsgBox gPDb.ErrDescription, vbInformation

Else

     Msgbox “ Error in associating dataclass with document “

End If