Commander
Commander
587 views

How to get the last created release ?

Jump to solution

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)
                continue;

                if (product.compare((_TCHAR*)obj.productId) == 0)
                {

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

                }
          }

}

Please help.

Tags (3)
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

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: https://www.microfocus.com/en-us/support/Dimensions%20CM%20(Release%20Vault)

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

--
Regards,
Alex

View solution in original post

6 Replies
Micro Focus Expert
Micro Focus Expert

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.

--
Regards,
Alex

Commander
Commander

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.

 

0 Likes
Commander
Commander

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 ?

0 Likes
Micro Focus Expert
Micro Focus Expert

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.

0 Likes
Commander
Commander

Hi Alex,

How can i contact R&D Teams ?

Can you have a link for that please ?

 

0 Likes
Micro Focus Expert
Micro Focus Expert

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: https://www.microfocus.com/en-us/support/Dimensions%20CM%20(Release%20Vault)

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

--
Regards,
Alex

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.