I am trying to use the PW API functions from C++ to update several attributes of documents. Although the sql calls return legitimate data and the functions called in the following code do not return any errors, the attributes are not changed when I look at the document properties.
//--------------------------------------------------------
targetBuf = aaApi_SelectLinkDataBuffer (fldrID, docID);
if (!targetBuf)
{
fwprintf_s(fpLog,_T("Unable to get buffer for %s\n"),filename);
skipFile = true;
}
else
if (!skipFile)
sVal = aaApi_DmsDataBufferGetStringProperty (targetBuf, LINK_PROP_COLUMN_VALUE, 0);
if (sVal != "")
if ((lColumnID = aaApi_DmsDataBufferGetNumericProperty (targetBuf, LINK_PROP_COLUMNID, 0)) == 0)
fwprintf_s(fpLog,_T("Error in aaApi_DmsDataBufferGetNumericProperty\n"));
//update all column values in buffer
swprintf_s(sqlQ, MAXQLEN, _T("%s\'%s\'"),sql2,jobStr);
if (aaApi_SqlSelect (sqlQ, NULL, &numCols) > 0)
if ((Location = aaApi_SqlSelectGetData(0, 0)) != NULL)
if (!aaApi_UpdateLinkDataColumnValue (tabID, location_descID,Location))
fwprintf_s(fpLog,_T("Unable to UpdateLinkDataColumnValue:%s\n"),aaApi_GetLastErrorMessage());
//more sql calls and updates have been omitted from this excerpt
if (!aaApi_UpdateLinkData (tabID, lColumnID, sVal))
swprintf_s(msg,MAXLINELEN,_T("aaApi_UpdateLinkData error: %s"),aaApi_GetLastErrorMessage());
fwprintf_s(fpLog,_T("%s\n"),msg);
aaApi_DmsDataBufferFree (targetBuf);
//----------------------------------------------------
Does anyone have some suggestions regarding why this isn't working?
Thanks,
Stephanie
Please disregard this post. I found that I was looking in the wrong datasource for updated attributes and when I looked at the correct DS all was good.
Sorry for the confusion,
Answer Verified By: Robert Hook
I have same question, Could you post your solution?
because , the aaApi_SelectLinkDataBuffer can't get data buffer for new document always.
Thanks'