J
Jake Thompson
This is the entire function from the module
long u_dll_cm8_getfolditemmatch(char *folderid, cm8linkstruc cm8link)
{
long l_stat = 0;
short dataid;
DKFolder* dkFOL = new DKFolder();
DKParts* dkParts = new DKParts();
DKLobICM* part = new DKLobICM();
DKString list;
int numD = 0;
int numF = 0;
DKString snumD;
DKString snumF;
DKString spnumber;
int count;
short itemPropertyType;
int h;
/*Create an ddoobject based upon the passed folder id */
DKDDO* ddoObject = dsICM->createDDO(folderid);
/*Get the contents of the folder */
dkFOL = (DKFolder*)(dkCollection*)
ddoObject->getData(ddoObject->dataId(DK_CM_NAMESPACE_ATTR,DK_CM_DKFOLDER));
dataid = ddoObject->dataId(DK_CM_NAMESPACE_ATTR,DK_CM_DKFOLDER);
if(dataid==0)
{
return 1; //No items in the folder
}
dkIterator* iter = dkParts->createIterator();
count = 0;
while(iter->more()) // while there are still items, continue
searching
{
part = (DKLobICM*) iter->next()->value(); // Move pointer
to next element & get the first note found.
itemPropertyType =
part->getPropertyByName(DK_CM_PROPERTY_ITEM_TYPE);
switch(itemPropertyType)
{
case DK_CM_DOCUMENT:
numD++;
snumD = DKString(numD); //Convert number to a string
strcpy(cm8link.type[count],"13"); //Copy the number 13 to indicate
folder
strcpy(cm8link.desc[count],"Document "); //copy the description
strcpy(cm8link.desc[count],snumD); //copy the current doc counter
to the description
strcpy(cm8link.item_increment[count],snumD); //copy Document
counter
cm8link.itemid[count] =
((DKPidICM*)part->getPidObject())->getItemId() ; //Get the itemid
break;
case DK_CM_FOLDER:
numF++;
snumF = DKString(numF);//Convert number to a string
strcpy(cm8link.type[count],"14"); //copy the number 14 to indicate
folder
strcpy(cm8link.desc[count],"Folder "); //copy the description
strcpy(cm8link.desc[count],snumF); //copy the current folder
counter to the description
strcpy(cm8link.item_increment[count],snumF); //copy Folder counter
cm8link.itemid[count] =
((DKPidICM*)part->getPidObject())->getItemId(); //Get the part number
break;
default:
break;
}
count++; //Increment the counter
}
delete(iter); // Free Memory
return 0;
}
This is the structure
struct cm8linkstruc
{
char* type; /* type of item*/
char* desc; /* description of item */
char* item_increment; /*increment value for item
in folder */
char* itemid; /* id of returned item */
};
As far as including the earlier text I do not know how to do that. I
am hitting reply so if I am not doing it right I apologize
long u_dll_cm8_getfolditemmatch(char *folderid, cm8linkstruc cm8link)
{
long l_stat = 0;
short dataid;
DKFolder* dkFOL = new DKFolder();
DKParts* dkParts = new DKParts();
DKLobICM* part = new DKLobICM();
DKString list;
int numD = 0;
int numF = 0;
DKString snumD;
DKString snumF;
DKString spnumber;
int count;
short itemPropertyType;
int h;
/*Create an ddoobject based upon the passed folder id */
DKDDO* ddoObject = dsICM->createDDO(folderid);
/*Get the contents of the folder */
dkFOL = (DKFolder*)(dkCollection*)
ddoObject->getData(ddoObject->dataId(DK_CM_NAMESPACE_ATTR,DK_CM_DKFOLDER));
dataid = ddoObject->dataId(DK_CM_NAMESPACE_ATTR,DK_CM_DKFOLDER);
if(dataid==0)
{
return 1; //No items in the folder
}
dkIterator* iter = dkParts->createIterator();
count = 0;
while(iter->more()) // while there are still items, continue
searching
{
part = (DKLobICM*) iter->next()->value(); // Move pointer
to next element & get the first note found.
itemPropertyType =
part->getPropertyByName(DK_CM_PROPERTY_ITEM_TYPE);
switch(itemPropertyType)
{
case DK_CM_DOCUMENT:
numD++;
snumD = DKString(numD); //Convert number to a string
strcpy(cm8link.type[count],"13"); //Copy the number 13 to indicate
folder
strcpy(cm8link.desc[count],"Document "); //copy the description
strcpy(cm8link.desc[count],snumD); //copy the current doc counter
to the description
strcpy(cm8link.item_increment[count],snumD); //copy Document
counter
cm8link.itemid[count] =
((DKPidICM*)part->getPidObject())->getItemId() ; //Get the itemid
break;
case DK_CM_FOLDER:
numF++;
snumF = DKString(numF);//Convert number to a string
strcpy(cm8link.type[count],"14"); //copy the number 14 to indicate
folder
strcpy(cm8link.desc[count],"Folder "); //copy the description
strcpy(cm8link.desc[count],snumF); //copy the current folder
counter to the description
strcpy(cm8link.item_increment[count],snumF); //copy Folder counter
cm8link.itemid[count] =
((DKPidICM*)part->getPidObject())->getItemId(); //Get the part number
break;
default:
break;
}
count++; //Increment the counter
}
delete(iter); // Free Memory
return 0;
}
This is the structure
struct cm8linkstruc
{
char* type; /* type of item*/
char* desc; /* description of item */
char* item_increment; /*increment value for item
in folder */
char* itemid; /* id of returned item */
};
As far as including the earlier text I do not know how to do that. I
am hitting reply so if I am not doing it right I apologize