If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Migrating Query Studio reports

Started by gohabsgo, 19 Sep 2017 01:41:11 PM

Previous topic - Next topic

gohabsgo

Hey Folks,
I seem to remember a method via sdk to extract a QS report to xml and then import it into a new environment, but can't for the life of me find it now and not sure if it's applicable to 11.0.6.

Any current methods for migration of Query Studio reports between environments other then export/import of deployment packages?

Thanks in advance!

-Dan

aussieadam

you should be able to getSpecification of a query from one environment. this can be done through sdk or query studio
then to add to a new environment using code like the following:
//connect and get report service
CognosConnection conn = new CognosConnection(dispatcherURL, nameSpaceId, userName,password);
conn.connectToCognos();
ReportService_PortType repService = conn.getRepService();
//add option is optional but i like specifying update
AddOptions addReportOptions = new AddOptions();
addReportOptions.setUpdateAction(UpdateActionEnum.update);

//create query option, set a default name and the query specification
AuthoredReport query = new Query();
query.setDefaultName(new TokenProp(null,queryName));
query.setSpecification(querySpecification);

//set queryPath
SearchPathSingleObject queryPath = new SearchPathSingleObject();
queryPath.set_value(pathToQuery);

//add query
repService.add(queryPath, query, addReportOptions);




let me know if you need any clarification.

gohabsgo

Thanks for the quick response!

In this case we're not looking to just get the query speciication but the entire Query Studio report specification as you can in Report Studio - copy to clipboard etc...

Our end goal is to move a Query Studio report from environment A to enviornment B but the gotcha is that in environment B we need to point the Query Studio report to a different package (similar to how you can change the package definition in Report STudio).  My hope was to get an xml or similar specifical of the entire Query Studio report and do a find-replace for the package reference.

Thanks,
-Dan

aussieadam

Sure thing,

To accomplish that in query studio, you need to Open Query > Manage File > Report Defniition > Query Information.


hope that's what you were looking for.

-
Adam

gohabsgo

Thanks again.

That shows use the report definition and I can copy it out to a text editor and do the find/replace of the package name.  However there is no way to actually change it so the report switches nor can I import that definition into a new query studio report.

Or am I missing something once again?

aussieadam

yeah, the only way i know of to do that is through the SDK, which is the code i wrote above.

Or if you have the SDK samples you can do the following:

save the specification as a XML file
edit the AddReport.java and change the beginning of the addSpecCM
      /*String validateOutput = validateReportSpec(connection, reportSpec);
      if (!specOkay)
      {
         return "Add not performed.\n\n" + validateOutput;
      }*/

      AuthoredReport newReport = new Query();
you will also need to add imports
import com.cognos.developer.schemas.bibus._3.AuthoredReport;
import com.cognos.developer.schemas.bibus._3.Query;

Run the build.bat (may need to run from cmd line, or compile AddReport from cmd line) then the run.bat and point to the dispatcher of your desired environment.
choose add report and pick the xml you saved earlier.

aussieadam

Below is the list of instructions i used to accomplish this
1)   Save the query xml
2)   Edit C:\Program Files\ibm\cognos\sdk\sdk\java\ReportAdd\AddReport.java
a)   Add the following imports
a.   import com.cognos.developer.schemas.bibus._3.AuthoredReport;
b.   import com.cognos.developer.schemas.bibus._3.Query;
b)   changes lines 244-250:
/*String validateOutput = validateReportSpec(connection, reportSpec);
if (!specOkay)
{
   return "Add not performed.\n\n" + validateOutput;
}*/

AuthoredReport newReport = new Query();
3)   find your java jdk, mine is C:\Program Files\Java\jdk1.8.0_92\
4)   Edit build.bat
a.   Remove @echo off at the beginning
b.   Change set JAVA_HOME=<path of your JDK>
5)   open command line as admin
6)   cd "C:\Program Files\ibm\cognos\sdk\sdk\java\ReportAdd"
7)   in command line: build.bat
8)   In command line: C:\Program Files\Java\jdk1.8.0_92\bin\javac AddReport.java
9)   Run run.bat from windows explorer
10)   Enter prompts
11)   Choose Add Specification To Content Store then run option
12)   Find the xml you saved and give it a name
13)   Query should be added to the personal folder of the user you logged in as

gohabsgo

Great stuff Adam!

Will go through this after a few meetings I have lined up.

-Dan