Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
DSTSchedFactory
 Login/Join
 
Expert
posted
Dhagen provided us with a wonderful piece of code to submit on demand ReportCaster requests from a fex or html page (the code is shown below).

I have a few questions regarding this method, so I decided to create this new thread. His original response was in this thread:
CREATING DYNAMIC SUBJECT LINE FR E-MAIL DISTRIBUTION

I've got this working but I have a couple of tweaks I'd like to make.

I would like the format of the report to be based on what the user selects, HTML, PDF or EXL2K.

I assume I have to do something with
schedFact.setIBIB_sendformat(DSTSchedFactory.SENDFORMAT_HTML);
, but "SENDFORMAT_HTML" does not appear to be a text string, so I don't think I can simply build it with something like this:

schedFact.setIBIB_sendformat(DSTSchedFactory.SENDFORMAT_ + userSelectedFormat);

So, just for testing purposes, I tried
schedFact.setIBIB_sendformat(DSTSchedFactory.SENDFORMAT_PDF);
and I got an error: Code = -3; Message = IBIB_sendformat should be in the values of { HTML, DOC, WP}.

Where is all this documented?

Thanks,

Francis.



<%-- $Revision: 1.2 $: --%>
<%@ page language="java" import="ibi.broker.beans.*,ibi.broker.beans.handler.*,java.util.*,java.text.*" %>
<jsp:useBean id="schedFact" scope="request" class="ibi.broker.beans.DSTSchedFactory" />
<%

     /* 
      *  Expected parameters to be passed:
      *
      *  emailFrom = User email who processed the merchandise request.
      *  emailTo   = User who initialiated the merchandise request.
      *  merchId   = Unique merchandise request id.
      *  random    = Random number passed from the calling process.
      *
      */
		Date now = new Date();
		SimpleDateFormat formatter = new SimpleDateFormat( "yyyyMMdd" );
		
		DSTAuthenticate auth = new DSTAuthenticate();

                // expected parameters.
		String emailFrom = request.getParameter("emailFrom");
		String emailTo = request.getParameter("emailTo");
		String country = request.getParameter("COUNTRY");
                String car = request.getParameter("CAR");

		auth.setUser("admin");
		auth.setPass("");
		auth.setAgentProperty("localhost:8200");
		
		// build subject line with passed parms
		String emailSubject = "*** Some Description: Country: " + country + " Car: " + car + " ***"; 
		String interval = "O";
		String startdate = formatter.format(now);
		String starttime = "0600";
		String fex = "merchandise_request_confirmation";
		String[] parNames = {"COUNTRY","CAR"};
		String[] parValues = { country, car };

		schedFact.setAuthenticate(auth);

		schedFact.setIBIB_casteruser("admin");    
		schedFact.setIBIB_jobdesc("*** Some Description.  This will be deleted anyway ***");                            	
		schedFact.setIBIB_active("Y");                                    	
		schedFact.setIBIB_priority("3");                                  	

		schedFact.setIBIB_interval(interval); //Run Once   	
		schedFact.setIBIB_startdate(startdate);                            	
		schedFact.setIBIB_starttime(starttime);                                	
		schedFact.setIBIB_listtype(DSTSchedFactory.ADDRESSTYPE_SINGLEADDRESS); //send to one address	
		schedFact.setIBIB_distlist(emailTo); // access list name    	
		schedFact.setIBIB_method(DSTSchedFactory.METHOD_MAIL);   
		schedFact.setIBIB_mailfrom(emailFrom);
		schedFact.setIBIB_mailuser(emailFrom);
		schedFact.setIBIB_mailsubject(emailSubject);
		schedFact.setIBIB_asvalue("sent.htm");
		schedFact.setIBIB_mulpart("N");

		// notification 
		schedFact.setIBIB_notifyflag(DSTSchedFactory.NOTIFYFLAG_INACTIVE);  	
		schedFact.setIBIB_tasktype(DSTSchedFactory.TASKTYPE_EDA_FOCEXEC); 
		schedFact.setIBIB_servername("EDASERVE");
		schedFact.setIBIB_taskobj(fex); //URL being Schedled
		schedFact.setIBIB_execid("server-userid");
		schedFact.setIBIB_execpass("server-password");
		schedFact.setIBIB_sendformat(DSTSchedFactory.SENDFORMAT_HTML);

		schedFact.setIBIB_paramname(parNames);
		schedFact.setIBIB_paramvalue(parValues);

		schedFact.setIBIB_servername("EDASERVE");  
		
		// delete the job after execution.
		schedFact.setIBIB_deletejob("Y");

		DSTBeanHandler h = schedFact.getCreateScheduleHandler();
		h.processRequest();
		DSTAPIStatus status = h.getAPIStatus();
		int code = status.getErrorCode();
		if(code != DSTAPIStatus.NO_ERROR) {
			out.println("Code = " + code + "; Message = " + status.getErrorMessage());
			return;

		}

		DSTBeanResult result = h.getBeanResult();
		Vector xml = result.getXML();		
		String sid = null;
		String stag = "<IBIB_scheduleid>";
		String etag = "</IBIB_scheduleid>";
		for(int i = 0; i < xml.size(); i++) {
			String temp = (String)xml.elementAt(i);			
			int index = temp.indexOf(stag);
			if(index != -1) {
				int end = temp.indexOf(etag);
				sid = temp.substring(index + stag.length(), end);
				break;
			}
		}
		out.println("Schedule ID = " + sid);
	
%>
<html>
     <head>
     </head>
     <body>
          <h2>Some Confirmation message.</h2>
     </body>
</html>  



Call with:

 
http://server:port/rcaster/custom/scheduleExample.jsp?e...TRY=JAPAN&CAR=DATSON


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
I find that the ReportCaster API Developer's
Reference manual is very difficult to understand - it shows detailed Java syntax but has very poor examples on how to use the stuff.

Why can I not find "SENDFORMAT_HTML" any where on IBI tech support?

How do I make "schedFact.setIBIB_sendformat(DSTSchedFactory.SENDFORMAT_HTML);" flixible, based on user selected format?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
Francis,

When you call your jsp include the jsp parametername an equal and then its value.

Example:

../scheduleExample?format=HTML


Then in your jsp code use

String fmt = request.getParameter("format");
schedFact.setIBIB_sendformat(fmt);" 


Fernando


Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
 
Posts: 278 | Registered: October 10, 2006Report This Post
Expert
posted Hide Post
Fernando, thanks, I'll give that a try. I wonder what this syntax is then:

quote:
DSTSchedFactory.SENDFORMAT_HTML


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
I still get the error

Code = -3; Message = IBIB_sendformat should be in the values of { HTML, DOC, WP}.

when I pass PDF or EXL2K.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
How do set the schedule to self destruct after execution?

The command
schedFact.setIBIB_deletejob("Y");
doesn't seem to work.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Francis,

As per my message. The example you have is using the old RC Bean technology. This API was functionally stabilized at version 5.2. So this is my guess (you should really confirm this with CSS): I believe that 5.2 did not have the ability to send a report as an email attachment in the API. Therefore, the error message you are getting is correct in that only the shown formats are available when using email.

I'm going to finish up that MRE name test for you today, and I will try to post an example of a JSP using the new API today or tomorrow. I have plenty of examples that I have done for customers, but they are all servlet based using CMV models. Extracting the necessary code will take a little bit of time.

FYI
quote:
I wonder what this syntax is then: DSTSchedFactory.SENDFORMAT_HTML


That is what is called a static reference. You should use static references when using an API because they represent a layer of abstraction between your code and the API. In version 4 (or 3) the DSTSchedFactory.SENDFORMAT_HTML use to be an integer. In version 5 it is a String. These references allow you to properly use the method while protecting you from that method changing in the future. I realize that this is a moot point with an API that will not change, but it is still considered best practice.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Expert
posted Hide Post
So this is antique code even before we fully appreciate it?

Thanks for the explanation D.

Regards,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Francis,

I was wrong! It was buried in the doc, but I found it.

Add the line:
schedFact.setIBIB_mulpart("Y");


Before the line:
schedFact.setIBIB_sendformat(DSTSchedFactory.SENDFORMAT_PDF);  


And you will get your attachment just fine.

I couldn't find the it mentioned anywhere ... I finally found it in a 4.3 version of the Java Doc for DSTSchedFactory.

Talk about a needle ....


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Expert
posted Hide Post
dhagen,

It works perfectly when I add the line you specify!

Thanks so much.

For the case I opened, Tech Support said:

"... WebFOCUS 532 has been functionally stabilized and we will not be issuing functionality enhancements for this version. However, EXL2K is not supported under any version of webfocus and ReportCaster. If you upgrade to WebFOCUS 710 or higher, you will be able to submit reports with an output format of PDF..."

"EXL2K is not supported under any version of webfocus and ReportCaster"!!! I will have to inform them of your suggestion.

Regards,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Hi Francis and all you other Focal Pointers,

Is anyone aware of any updates on this: Spawning a Report Caster (RC) job from within a fex?

I'm looking for a method to do the following:

1) [To Do] Kick off a Report Caster (RC) job from within a fex.
2) [Done] Sleep for a while (periodically checking for the existence of some status file to be created by that "spawned" job).
3) [Done] Check for either a “pass” or a “fail” condition.
4) [Done] Either abend of continue on to spawn another job (until there are no more jobs to be spawned).
5) [Done] Exit accordingly. (I'll -EXIT with a non-zero return code - Unless there's a better way).

As you can see, I’m only missing that 1st piece.

As Always, I thank you in advance for your insight.
Doug




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Doug, I thankfully haven't had to do this again since my original attempt in 2008.

I recently worked on a project where the parameter screens were created by HTML Composer. I added a Schedule button that makes a call to a JSP page with the schedule parameters - this is all from the GUI, and with WF provided JSP files.

I guess this doesn't help you as you want to kick of a RC job in the background, not from a parameter screen.

I would open a case with IB Tech Support - they are quite helpful with this kind of thing.

Cheers,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Thanks Francis,

I'll leave this open (Really? I can't close this anyway as it's not mine.) for a while and will open a case in the morning, with a reference to this thread.

Cheers,
Doug
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Platinum Member
posted Hide Post
Hi,

You should be able to use DSTRUN to execute a schedule from within a fex.

Documentation on the command is in the report caster manual.

Crystal


Webfocus 8.0.7 on Windows
 
Posts: 176 | Location: Ohio | Registered: October 26, 2006Report This Post
Expert
posted Hide Post
DSTRUN is mentioned in the ReportCaster API Developer's Reference document for both 7.6.1 and 7.7.02 which means it's still around...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Thanks Francis and Crystal... I need to use this IF we cannot get our systems scheduler (opcon) to wait for the end of the report caster job. Right now, opcon accepted the "submitted" reply from RC as "job successfully completed". Thus, the other jobs (all the remaining job) which need this job (the first job) sees the predecessor as completed successfully, when it's not, it's just been submitted by RC. We're going to modify the batch file which opcon is submitted (that's where the RC return code is being checked). So, it's on to other things for the time being.

Thanks again ~ Doug Cool
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
Doug, I thought OpCon was suppose to be an asynchronous event driven scheduling system. So, why have it wait at all? Why not have RC generate an event that OpCon and listen for and forget any of this ever happened.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders