How to get the last created release ?

Hi all,

I want to know if there is a command that i can get the last created release by PCMS api ?

i try this code as below but i don't know how to continue to get result faster:

PcmsObjStruct obj = { 0 };
obj.objType = PCMS_BASELINE;
int noUids = 0;
int *uids = NULL;

string product = "COH12";

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)

                if (*)obj.productId) == 0)

                       printf( "%s:%s\n", (_TCHAR*)obj.objId, (_TCHAR*)obj.dateTime);



Please help.


  • Hi,

    The first thing to try could be initial filter by the product value (as input to PcmsQuery), so you get only UIDs from interesting you product.

    Looking at docs (Developer’s API Reference PDF) that should be something like:

    obj.noAttrs = 1; obj.attrs = (PcmsObjAttrStruct *)PcmsEvntCalloc(sizeof(PcmsObjAttrStruct)); obj.attrs[0].attr = PCMS_ATTR_PRODUCT_ID; PcmsSvaSetVal(obj.attrs[0].value,"COH12",0); // then call PcmsQuery and you should not get other than baselines from COH12 ... // At the very end do not forget to free memory PcmsObjFree(&obj); PcmsEvntFree(uids);

    Theoretically the latest baseline should have the maximum UID, but that's not really guaranteed, so not reliable.

    One other thing you may try - using PcmsFullQuery instead of PcmsQuery, which should query object data in bulk, so faster than per each one in a loop. I see that docs state "The objType field in the PcmsObjStruct can currently only be PCMS_CHDOC", but I am not certain that is correct. So, it's worth trying.


  • Hi Alex

    Thank's for your answer.

    Your code help me a bit to get a minimum all releases about the product COH12.

    I will try to convert datetime for each release item and to be sorted in the end.

    I think it's can help.


  • Alex,

    I replace the objType of obj by PCMS_RELEASE. (as below)

    PcmsObjStruct obj = { 0 };
    obj.objType = PCMS_RELEASE;
    obj.noAttrs = 1;
    obj.attrs = (PcmsObjAttrStruct*)PcmsEvntCalloc(sizeof(PcmsObjAttrStruct));
    obj.attrs[0].attr = PCMS_ATTR_PRODUCT_ID;
    PcmsSvaSetVal(obj.attrs[0].value, "COH12", 0);
    int noUids = 0;
    int *uids = NULL;
    int res = PcmsQuery(conId, &obj, 0, &noUids, &uids);

    i get res equal to -1.

    Why please ?

  • Sorry, looking at the previous code example I thought you just name baselines as releases. As for PCMS_RELEASE object type, I am afraid that is not supported to query this way. You can raise this with Support, so R&D researches in more details.

    Other and likely faster option can be querying DB through the Published Views. Maybe other users have examples to share, I have no.

  • Hi Alex,

    How can i contact R&D Teams ?

    Can you have a link for that please ?


  • Verified Answer

    You'd need to contact Micro Focus Support, so they work with R&D

    Here is a link to Report an Incident

    Main Support page for the product: CM (Release Vault)

    Please mention the link to this Community conversation while reporting the incident.