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.
I have a report containing rows of sales order data. One of the columns is a drill-down that the user clicks on to print a label for the specific row.
After the label is printed I would like to update a column on the row to indicate that the label has been printed. Maybe a column whose field value is "Y" when the label has been printed and "N" when it hasn't. I would also like to write this flag off to disk and then use it the next time the report is ran to indicate whether the labels had already been printed for specific rows.
Does anyone have any ideas on how to do this? This really sounds more like a database application rather than a report but I don't want to create a program for this.
Norb, you're right , its a database application. just a tiny little fex with MODIFY commands to UPDATE a separate file you've created. When you say 'write this flag off to disk and use it again', that's exactly the file you'ld be MODIFYing and joining in to your report, so that the current status of printed/notprinted would be displayed. Its not hard..its really the right way to go...
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
You could trigger some javascript and then use xmlhttp to update the database for you. If you follow this with a form submission then the report will refresh and show you the updated flag.
A sample of how to - First the data -
APP FILEDEF NORBMAST DISK ibisamp/norbdata.mas
-RUN
-WRITE NORBMAST FILE=NORBDATA,SUFFIX=FOC
-WRITE NORBMAST SEGNAME=SEG1
-WRITE NORBMAST FIELD=NORBDATA_KEY, ,FORMAT=A10 ,FIELDTYPE=I, $
-WRITE NORBMAST FIELD=PRNT_FLAG, ,FORMAT=A3 , $
-RUN
USE
ibisamp/norbdata.foc NEW
END
CREATE FILE NORBDATA
MODIFY FILE NORBDATA
FREEFORM NORBDATA_KEY PRNT_FLAG
DATA
Report No1,N
Report No2,N
Report No3,N
Report No4,N
Report No5,N
Report No6,N
END
-RUN
Place that in a temporary (or permanent) fex and run it to create the sample data that you will use.
Then copy and paste this code into a fex called "NorbPrnt.fex" in the IBISAMP application folder. The name is important because it is called from within the HTMLFORM. This whole fex will do everything you need -
APP PREPENDPATH IBISAMP
SET NODATA = ''
DEFINE FILE NORBDATA
END
TABLE FILE NORBDATA
PRINT COMPUTE Item/P2 = LAST Item + 1; NOPRINT
COMPUTE Idx/A2 = LJUST(2, PTOA(Item, '(P2)', 'A2'), 'A2'); NOPRINT
COMPUTE PRINT_BTN/A200 = IF PRNT_FLAG EQ 'Y' THEN 'Printed'
ELSE '<input type="button" value="Print Report" style="size:9;width:80;height:30;"'
||'onClick="PrintReport('||Idx||')">'; AS ''
BY NORBDATA_KEY AS ''
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE HOLD AS NORBTAB FORMAT HTMTABLE
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, FONT='Arial', SIZE=9, SQUEEZE=ON, $
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN
<html>
<head>
<title>Sample Update</title>
<!-- The only IB scripts required are ibirls but this requires ibigbl so we include that here -->
<!-- ibirls2 is not used as it removes the onchange event and screws the processing -->
<script id=IBI_OptionsScript type=text/javascript>
var ibirls = "ibirls";
var ibiOptions = new Array(ibirls);
</script>
<script id=IBI_ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript></script>
<script type=text/javascript>
function PrintReport(Idx) {
var request = '/ibi_apps/WFServlet?IBIC_server=EDASERVE&|IBIAPP_app=ibisamp&|IBIF_adhocfex=MODIFY
FILE NORBDATA%0D%0AFREEFORM NORBDATA_KEY PRNT_FLAG%0D%0AMATCH NORBDATA_KEY%0D%0AON MATCH UPDATE
PRNT_FLAG%0D%0AON NOMATCH REJECT%0D%0ADATA%0D%0AReport No'+Idx+',Y,$%0D%0AEND&|Rand='+Math.random();
if(request) {
var xmlDoc = getXml(request);
} else {
alert("An error populating input control");
}
document.form.submit();
}
</script>
</head>
<body>
<form name="form" method="post" action="/ibi_apps/WFServlet">
<!-- Application version variables
-->
<input type=hidden name="IBIF_ex" id="IBIF_ex" value="norbprnt.fex">
<input type=hidden name="IBIAPP_app" id="IBIAPP_app" value="ibisamp">
<!-- MRE / BID Version variables
<input type=hidden name="IBIMR_action" value="MR_RUN_FEX">
<input type=hidden name="IBIMR_sub_action" value="MR_STD_REPORT">
<input type=hidden name="IBIMR_domain" value="norbsamp/norbsamp.htm">
<input type=hidden name="IBIMR_folder" value="#default">
<input type=hidden name="IBIMR_fex" value="app/norbprnt.fex">
-->
<!-- Common variables -->
<input type=hidden name="WF_DESCRIBE" id="WF_DESCRIBE" value="OFF">
<input type=hidden name="IBIMR_random" id="IBIMR_random" value=0>
!IBI.FIL.NORBTAB;
</form>
</body>
</html>
-HTMLFORM END
First it prepends IBISAMP to your path to ensure that you can see the data created above. Next it creates an HTMTABLE output to be included within a pair of HTMLFORM labels. This includes a decoding of the print flag to show a button if the report is not printed. The button is set to call a JS function upon clicking it. Now, within this HTMLFORM there is a form and the necessary control to allow the fex to be executed upon form submission. The important parts are the inclusion of the IBI standard JS modules, IBIRLS and IBIGBL, followed by the script that receives a number that is used to identify the key from the NORBDATA file. This is used within a URL that is contains an adhoc fex to perform a MODIFY against NORBDATA.
This can get rather messy, but if you understand MODIFY and you do not have a MAINTAIN license, then it is a good alternative.
Good luck
TThis message has been edited. Last edited by: Tony A,
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
One thing to mention is that the "request" URL could as easily point to a "little MODIFY fex" as Susannah has said, that performs your print process and then modifies the print flag for you.
All you have to do is open your mind to the possibilities on how to achieve exactly what you require to be done.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Susannah - I have never used MODIFY and don't have the time to dig into it at this moment but will check it out in the future. However, your affirmation tells me that my head is in the right place. (This time anyway).
Tony - Thank you for your detailed post. You presented some interesting code and concepts in your reply that I am anxious to review and understand. I appreciate you putting the code out there with explanations. I have to admit that the some of the code is over my head but I'm sure I can leverage this in the future. The more I use WebFocus, the more I have been extending it with CSS, HTML, Javascript etc. and doing some pretty cool stuff.
As I think about this more, I'm probably going to tell the user to forget about a "label printed tracking feature". Primarily because I don't have as much control over the process as needed to insure that the user doesn't get themselves into trouble. Specifically, in the current iteration of the report, I am displaying a little printer icon in a column of a row that is applicable to be printed. This calls a fex that creates the label and outputs to the screen as PDF. At this point the user could print the label BUT if he cancels out of the Acrobat Reader program how would I know that the label was not actually printed? I would end up updating the "print status" field and table with bad data.
You can let the program "ask" the user if the label was printed correctly and after a "yes" do the update. At that point you might get some users that come to you and say, "I answered yes, but ....." That's IT....and real live....nothing is certain and even that is uncertain....
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006
cool idea to have a print icon as a data row , kicking off a pdf for that row's stuff... i made an icon out of the new Adobe8 image, i liked the particular red they used this version. You could have another box in fex#1, next to the print icon, with an "N" in it, and the end user clicks it, a drill down (in this case a drill up) pops up a window where a fex#2 has created a FORM and the user clicks the "yes i printed it ok " and this little form clicks off fex#3 which performs the MODIFY on that tiny little YesNo file you've made to collect this info, and reruns fex#1 which Joins your basic data back to that now-modified YesNo file, and the user will now see the "Y" in the original report. ..which is pretty much what Amsterdam Frank just said.. ... I actually am glad you asked this question because i have a use for this very thing... End user generates PDF of Order Confirmation and emails it to client herself,with appropriate personalized thank you, then checks the box so we know the Order has been confirmed. i'm liking this
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
Typically, I like the user experience to be devoid of little prompts and boxes requesting confirmation of this or that.
However, Susannah, I like your concept of letting the user update the data of their own accord as you detailed. I'm thinking that I would display a Y/N for records that had been verified by the user and a "?" for new records. Then if they choose to update their data then so be it. If not - well that's O.K. too! It's all up to them in how they want to use the software.
You have convinced me to at least try it now. I'll code it and see "how it feels".