cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

QB Report from a Workflow

srector
1-Visitor

QB Report from a Workflow

I am looking for an example of how to trigger a query builder report from a workflow, andcapture itin some type of file format. I've been rummaging through the forums but keep striking out.


If anyone would be willing to share an example I would be most appreciative.



Thank you for your time,


Steve

5 REPLIES 5
ddemay
7-Bedrock
(To:srector)

You would have to use Info*Engine task from workflow and the webject would
invoke report I believe is how it would have to work. Otherwise, URL robot
to URL for report and suck in contents to workflow to do something with it,
i.e. write to a file.




srector
1-Visitor
(To:srector)

Thank you for your comments David.



I was leaning toward the later solution. I figured out how to re-code the URL to use the custom .xsl file I created, but I couldn’t figure out how keep it from popping open a window to select a file-save location. I need to have it automatically save the file without user interaction. There is an ‘action=’ command, but I couldn’t find any references on what arguments are allowed.



The Info*Engine task might be the better way to go, but I would be facing a steep learning curve since I’ve never written one before.

srector
1-Visitor
(To:srector)

But when I add the 'Apply-XSL' webject to my task, I get an error, and I just can't seem to sort out what I am doing wrong.



Here is my task:


------------------------------


<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>


<description>Generates a report from the named report template.</description>


<ie:webject name="Generate-Report" type="OBJ">


<ie:param name="INSTANCE" data="corp.drs-sts.victoro.windchill"/">


<ie:param name="DBUSER" data="wcadmin"/">


<ie:param name="PASSWD" data="windchill9"/">


<ie:param name="INPUT" data="Part" number="700314%" &quot;="/>


<ie:param name="WHERE" data="name='zWTPart"/">


<ie:webject name="Apply-XSL" type="DSP">


<ie:param name="DBUSER" data="wcadmin"/">


<ie:param name="PASSWD" data="windchill9"/">


<ie:param name="XSL_URL" data="simpleHtmlFormat.xsl"/">





<wc:message>Failed to compile stylesheet. 1 error detected. Nested exception is: org.xml.sax.SAXException: Failed to compile stylesheet. 1 error detected.</wc:message>


srector
1-Visitor
(To:srector)

An update.....


After going back through the IE User Guide, I figured out why I was getting this error. I ran across the following statements:


• Authoring Info*Engine Tasks:All webjects that do not directly deal with the display of information can be placed in Info*Engine tasks. That is, any webject with a type equal to "DSP" exists only in a JSP page (or custom application).


• Specific Task Rules:Tasks cannot contain any display elements such as display webjects. If HTML tags are in a task, they are ignored.


So I abandoned the idea of using a display webject and have been focusing instead on just capturing the raw xml in a text file. My current approach is to use the following I*E Task. Unfortunately, while this seems to be doing something (it churns and churns in my browser), it eventually just spits the XML output to my browser screen, leaving the text file empty.


If anyone knows how to direct the output to a file, instead of my screen, I would really appreciate your help.


Thanks,


Steve





<%@page language="java" session="true" %>


<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>


import java.lang.Object;


import java.lang.String;


import java.util.List;


import java.util.Iterator;


import java.io.PrintStream;


import com.infoengine.object.factory.Group;


<ie:webject name="Generate-Report" type="OBJ">


<ie:param name="INSTANCE" data="corp.drs-sts.pdmtest.windchill"/">


<ie:param name="INPUT" data="Part" number="700314%" &quot;="/>


<ie:param name="WHERE" data="name='zWTPart"/">


<ie:param name="GROUP_OUT" data="rptGroup"/">


</ie:webject>


<%


java.io.PrintStream pS=new java.io.PrintStream("D:/PTC/zztop.txt");


com.infoengine.object.factory.Group outRpt=new com.infoengine.object.factory.Group("rptGroup");


java.util.List rptList=outRpt.getElementList();


java.util.Iterator itEl=rptList.iterator();


while(itEl.hasNext()){


pS.println(itEl.next());


}


%>

Hi Steven,



maybe this will help you.


File file = new File(fileName);
FileOutputStream outStream = new FileOutputStream(file);
PrintWriter myOut = new PrintWriter(outStream);


Group group = vdb.getGroup("outputgrp");
group.toXML(myOut,true, true);
myOut.flush();



Best regards.


Nenad


In Reply to Steven Rector:



An update.....


After going back through the IE User Guide, I figured out why I was getting this error. I ran across the following statements:


• Authoring Info*Engine Tasks:All webjects that do not directly deal with the display of information can be placed in Info*Engine tasks. That is, any webject with a type equal to "DSP" exists only in a JSP page (or custom application).


• Specific Task Rules:Tasks cannot contain any display elements such as display webjects. If HTML tags are in a task, they are ignored.


So I abandoned the idea of using a display webject and have been focusing instead on just capturing the raw xml in a text file. My current approach is to use the following I*E Task. Unfortunately, while this seems to be doing something (it churns and churns in my browser), it eventually just spits the XML output to my browser screen, leaving the text file empty.


If anyone knows how to direct the output to a file, instead of my screen, I would really appreciate your help.


Thanks,


Steve





<%@page language="java" session="true" %>


<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>


import java.lang.Object;


import java.lang.String;


import java.util.List;


import java.util.Iterator;


import java.io.PrintStream;


import com.infoengine.object.factory.Group;








<%


java.io.PrintStream pS=new java.io.PrintStream("D:/PTC/zztop.txt");


com.infoengine.object.factory.Group outRpt=new com.infoengine.object.factory.Group("rptGroup");


java.util.List rptList=outRpt.getElementList();


java.util.Iterator itEl=rptList.iterator();


while(itEl.hasNext()){


pS.println(itEl.next());


}


%>


Announcements


Top Tags