I have a process that executes the command hco to download a specific package from a specific project. When the user chooses the wrong proyect (from a combo box) or the package is not in the required state, the hco command downloads nothing and the error message I show says that.
Is there a command to find info from a specific package in a project? Such as which state or environment it is located? Or to check if it is in the project? What I'm trying to do is show more info on the error using those commands, for example :
- "Package *** is not located in the selected project"
- "Package *** is not located in the state YYY in the selected project, it is in the ZZZ state"
To enhance the error message return of an SCM transaction would require for this to be an enhancement
for which you would have to submit a new "Idea" to be voted on.
To provide a list of packages associated to a state or states within a project there is no command line utility
for this, however, the user can use the hsql command line to run a custom SQL query against the database
to get this list of packages, then view the results .dat file.
hsql -b broker -usr userid -pw pswd -t -f "QueryForListOfPackages.sql" -o "C:\temp\hsqlresults.dat"
SELECT HARENVIRONMENT.ENVIRONMENTNAME, HARSTATE.STATENAME, HARPACKAGE.PACKAGENAMEFROM HARENVIRONMENTINNER JOIN HARSTATEON HARENVIRONMENT.ENVOBJID = HARSTATE.ENVOBJID LEFT JOIN HARPACKAGE ON HARPACKAGE.STATEOBJID = HARSTATE.STATEOBJID WHERE HARENVIRONMENT.ENVIRONMENTNAME = 'YourProjectName'ORDER BY HARSTATE.STATEORDER, HARPACKAGE.PACKAGENAME
Since you have said that your user selects a project from a drop down list, so I am guessing that you're using either the HSDK or JHSDK in a custom program you have created. Would this be correct?
You could use SQL to get a list of packages in a specific project:
where envobjid = (select envobjid from harenvironment where environmentname = 'My Project');
Or to get a list of packages in a specific project and state:
where envobjid = (select envobjid from harenvironment where environmentname = 'My Project')
and stateobjid = (select stateobjid from harstate where statename = 'My State');
Or find the project and state for a package:
select environmentname, statename
from harpackage, harstate, harenvironment
where harpackage.stateobjid = harstate.stateobjid
and harpackage.envobjid = harenvironment.envobjid
and packagename = 'My Package';
Let me know if this helps.