Random Error when Updating Attributes

Hi experts,

I wrote a folder commnd to create a bunch of empty documents in this folder which has an environment, and then update doument's attributes values ( actually 4 attributes) as soon as the document is created. So far everying works fine except that sometimes one attribute ( "LookupType") value becomes strange characters. The problem is random, in most times, no error at all for all docus, so I can't reproduce it at will, and I noticed only this attribute has problem. The difference between this attribute "LookupType" and other 3 attributes is this attribute can use pulldown value. But my value for this attribute is one of these pulldown values..

Here is my code.


			docID = CreateLookupFile(lProjfolderId, CString(areacode), CString(description));

			if (docID !=0)

				if (FALSE == UpdateDocAttrAll(lProjfolderId,docID,sParentProjName,sProjName,CString areacode),CString(description)))
					ShowErrorMessage (nResCode, L"Failed to update attributes");

				//press F5!, so we can see new doc appears one by one..


BOOL UpdateDocAttrAll(LONG lProjNo, LONG lDocNo, LPCWSTR strValue1, LPCWSTR strValue2, LPCWSTR strValue3, LPCWSTR strValue4)
  BOOL bRtn = TRUE;

  LONG lLinkCount = aaApi_SelectLinks(lProjNo,lDocNo);

  for (LONG i = 0L; i < lLinkCount; i++)
        //get o_tabno
	LONG lTableId = aaApi_GetLinkNumericProperty(LINK_PROP_TABLEID,i);
	//get o_colno
        LONG lLinkColumnId = aaApi_GetLinkNumericProperty(LINK_PROP_COLUMNID,i);
	//get o_colvalue
        LPCWSTR strLinkColValue = aaApi_GetLinkStringProperty(LINK_PROP_COLUMN_VALUE,i);

	//here lColumnId is hard coded!
        aaApi_UpdateLinkDataColumnValue(lTableId, 1, strValue1);
	aaApi_UpdateLinkDataColumnValue(lTableId, 2, strValue2);
	aaApi_UpdateLinkDataColumnValue(lTableId, 3, strValue3);
	aaApi_UpdateLinkDataColumnValue(lTableId, 4, strValue4);
    if (!aaApi_UpdateLinkData(lTableId, lLinkColumnId, strLinkColValue))
        bRtn = FALSE;

  return bRtn;

This random problem really frustrated me, please help me out, thanks in advance.

Parents Reply Children