This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to retrieve all baseline for specific project using pcms api ?

Hi all,

I have a problem to get all baseline for specfic project.

I have several baselines which are attached to different projects of a given product. Below, I managed to filter all the baselines of a given product but not of a project too. How can we filter by a product and a project please?

const char* product = "71_BWN00"; const char* project = "N6.LL"; PcmsObjStruct obj = { 0 }; obj.objType = PCMS_BASELINE; obj.noAttrs = 1; //obj.noAttrs = 2; obj.attrs = (PcmsObjAttrStruct*)PcmsEvntCalloc(sizeof(PcmsObjAttrStruct)); obj.attrs[0].attr = PCMS_ATTR_PRODUCT_ID; //obj.attrs[1].attr = PCMS_ATTR_PROJECT; PcmsSvaSetVal(obj.attrs[0].value, product, 0); //PcmsSvaSetVal(obj.attrs[1].value, project, 0); int noUids = 0; int* uids = NULL; if (PcmsQuery(conId, &obj, 0, &noUids, &uids) == PCMS_OK && noUids) { for (int i = 0; i < noUids; i ) { if (PcmsInitUid(conId, uids[i], PCMS_BASELINE, &obj) != PCMS_OK) continue; // use "obj" to get details of Product printf("%s \n", (_TCHAR*)obj.objId); } } PcmsObjFree(&obj); PcmsEvntFree(uids);
  • 0
    Any suggestion please ?
  • 0   in reply to 

    Hello,

    You could try to using PcmsObjGetRels() with objType=PCMS_WORKSET and options=PCMS_BASELINE. First obtain the project uid (fromObjUid parameter), then invoke PcmsObjGetRels() and then get baseline uids (ptrPcmsRelStruct->uid).

    Alternatively if baselines related to project have similar unique ID’s, f.e.: PRJ1_BLN1,PRJ1_BL2… etc. in PcmsQuery () you can specify sql pattern for baseline id in PCMS_ATTR_OBJ_ID, f.e.:  PRJ1_BLN%

  • 0 in reply to   

    Hi Richard,

    Thank's for your answer.

    I did like you said as below :

    const char* product = "71_BWN00"; const char* project = "N6.LL"; int result = PCMS_ERROR; PcmsObjStruct obj = { 0 }; obj.objType = PCMS_WORKSET; obj.noAttrs = 1; obj.attrs = (PcmsObjAttrStruct*)PcmsEvntCalloc(sizeof(PcmsObjAttrStruct)); obj.attrs[0].attr = PCMS_ATTR_PRODUCT_ID; PcmsSvaSetVal(obj.attrs[0].value, product, 0); int noUids = 0; int* uids = NULL; int stat = PCMS_ERROR; if (PcmsQuery(conId, &obj, 0, &noUids, &uids) == PCMS_OK && noUids) { for (int i = 0; i < noUids; i ) { if (PcmsInitUid(conId, uids[i], PCMS_WORKSET, &obj) != PCMS_OK) continue; if (strcmp(obj.objId,project) == 0 ) { int norels = 0; int i = 0; PcmsRelStruct* ptrPcmsRelStruct = (PcmsRelStruct*)0; result = PcmsObjGetRels(conId, obj.uid, PCMS_WORKSET, PCMS_BASELINE, 0, &norels, &ptrPcmsRelStruct); printf(" Baseline for project : %s is %s \n", project, ptrPcmsRelStruct->uid); } } } PcmsObjFree(&obj); PcmsEvntFree(uids);

     

    But how i continue to get baseline value please ?

  • Verified Answer

    0 in reply to 

    It's ok for me. i arrived to get the answer.

    Thank's all.

    if (PcmsObjGetRels(conId, obj.uid, PCMS_WORKSET, PCMS_BASELINE, 0, &norels, &ptrPcmsRelStruct) == PCMS_OK) { PcmsObjStruct itemObj = { 0 }; for (i = 0; i < norels; i ) { if (PcmsInitUid(conId, ptrPcmsRelStruct[i].uid, PCMS_BASELINE, &itemObj) == PCMS_OK) printf(" Baseline for project : %s is %s \n", project, itemObj.objId); } }