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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Finding the size of the PDF report scheduled in ReportCaster.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Finding the size of the PDF report scheduled in ReportCaster.
 Login/Join
 
<Navin>
posted
We are scheduling a fex file using Report Caster. This fex file generates a PDF
output which is FTPed to a server.

Our requirement is to capture the size of this PDF generated and create a text
file which will contain the size of the PDF file and FTP the text file also to
the same server.

Let us know the feasibility and how we can implement this.

This message has been edited. Last edited by: Kerry,
 
Report This Post
Expert
posted Hide Post
Could you do an operating system command like dir for Windows or ls -l for Unix, pipe the output to a file, and then parse the results to get the pieces of information you need?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
<JG>
posted
Ginny problem with that is the Caster job will have already finished.

What it implies is a double pass of the final output + a few other steps.

HOLD
OS get file size
ftp file size file
PCHOLD
 
Report This Post
Virtuoso
posted Hide Post
So supposing that there was a way to do this, what happens if the predetermined size ends up not matching the actual size of the FTP file after is is transferred. This probably would not happen but could, in theory. Seems like your best bet would be to use some OS command on the destination platform after the transfer to get the file size. Whatever it is that is needing the .txt file (which would probably help a lot if THAT was explained) could probably find that info by itself without having to read it from a file.

Last item, my understanding is that a single RC job can only distribute a single output item (aside from bursting) so sending the PDF file and sending the size file would not be accomplished in the same RC job, but would need two separate ones. Could be wrong on that one, but that has been my experience. If true, then you got two separate and disconnected processes trying to communicate similar data while running separately.

While I don't know the exact reason for your requirement, I don't think this is the correct approach to your solution.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
Assuming it is running on a Windows box...

The problem is getting ReportCaster to do all of that. If you hold the PDF file, it won't be distributed by RC, unles you run it again without the hold. And if you run it again, just hope that it contains the same data as the first time. Then (as stated before) try and get RC to send BOTH the files - don't think it will happen.

Not trying to rain (or snow) on the parade, but there are a LOT of things to deal with here that could be accomplished with an OS command or script on the destination box.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
My question on this would be "Why do you want this?"




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, 2006Report This Post
<Navin>
posted
Hi Tom,

Thanks for your code. It is working fine.
But the file TESTPDF and SIZEPDF are getting created in the same directory as that of the fexfile.
How do we FTP this to another machine?

Thanks in advance
 
Report This Post
Expert
posted Hide Post
You can write an operating system script to do the ftp and then run it from your focexec.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
<Navin>
posted
Let me explain the complete requirement that might be of use to help me out...

We are trying to provide customers with static reports. These reports would be scheduled
to run everyweek and will be made available in our Reporting link.

On entering specific search criteria(like name of the report, week range) the corresponding pdf links would list and upon clicking the link the pdf file would open.

For this we need to generate a pdf file in the webfocus server and ftp it to another server which manages static reports.

Now, to enable searching of a specific pdf file in the reporting URL we require an index file which should have the name of the PDF, Week range and size of the specific PDF.

Let me know how we can achieve this...

Hope i have given a better picture about the requirement.

Any suggestions to implement this would be of grt use.
Thanks in advance.
 
Report This Post
<JG>
posted
Navin, I would not ftp your file information to the other server.

Instead do a network mapping to it and append your file information to it
as an html string. That way you build and maintain a single index listing

 
FILEDEF PDFLIST DISK C:\ibi\apps\baseapp\PDFLIST.HTM (APPEND
FILEDEF TESTPDF DISK PDFREPORT_&DMYY...PDF
-RUN
TABLE FILE CAR
SUM 
    RETAIL_COST
    DEALER_COST
  BY COUNTRY
  BY MODEL
  BY CAR
  ON TABLE HOLD AS TESTPDF FORMAT PDF
END
-RUN
! DIR *.pdf /-C > LIST.TXT
FILEDEF LIST DISK LIST.TXT (LRECL 200 RECFM V
-RUN
-REPEAT READLIST 99 TIMES
-READ LIST NOCLOSE &DATALINE.A200.
-IF &DATALINE CONTAINS '.PDF' GOTO QUITREAD;
-READLIST
-QUITREAD
!COPY PDFREPORT_&DMYY...PDF C:\ibi\apps\baseapp\PDFREPORT_&DMYY...PDF
-SET &DATALINE=SQUEEZ(200, &DATALINE, 'A200');
-SET &FILEDATE=GETTOK(&DATALINE, 200, 1, ' ', 50, 'A50');
-SET &FILETIME=GETTOK(&DATALINE, 200, 2, ' ', 50, 'A50');
-SET &FILEAMPM=GETTOK(&DATALINE, 200, 3, ' ', 50, 'A50');
-SET &FILESIZE=GETTOK(&DATALINE, 200, 4, ' ', 50, 'A50');
-SET &FILENAME=GETTOK(&DATALINE, 200, 5, ' ', 50, 'A50');
-* the following is a single line of code
-WRITE PDFLIST <li><a href="http://localhost:8080/approot/baseapp/&FILENAME.EVAL">&FILENAME Created &FILEDATE &FILEAMPM Size &FILESIZE Bytes</a></li>
TABLE FILE CAR
SUM 
    RETAIL_COST
    DEALER_COST
  BY COUNTRY
  BY MODEL
  BY CAR
  ON TABLE PCHOLD AS TESTPDF FORMAT PDF
END
-RUN
 
Report This Post
Expert
posted Hide Post
Please see my post from yesterday. This technique works very well.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Virtuoso
posted Hide Post
We do almost exactly the same thing you are describing. After the files are sent from ReportCaster to a specific location on our Linux server, this script is run which reads the files and their attributes and creates an Index page which allows the users to see the available files, sizes and dates and download the ones they want to see. The platform, as mentioned, is Linux and you never mentioned your platform/OS so if it's not Unix/Linux someone else will have to translate this into something you can use.

I'm sorry I can't explain what all this does, I din't write the script nor do I profess to understand it. I just asked my Linux guy for the script that is run and this is what he gave me.
#!/usr/bin/perl

use CGI qw/:standard/;


# You'll want to change the following to suit your needs:
my $filedir = '/absolute/file/dir'; # filesystem path to directory of PDFs
my $indexdir = $filedir;	    # where should the outfile go?
my $outfile = 'index.html';	    # usually index.html or index.htm
my $title = 'Some Title Here';	    # title bar in browswer
my $logo = '/images/mylogo.gif';    # can be relative http path or full URL
my $logoalt = 'my company';	    # alt text if logo not found

# Don't like the colors?  Change these
my $bgcolor1 = '#FFFFCC';
my $bgcolor2 = '#FFFFFF';

# Usually you won't need to change anything below this line
my $file;
my $body = '';
my $toggle = 0;
my $filecount = 0;
opendir (FDIR,"$filedir") or die "Cannot open $filedir for reading: $!\n";
foreach $file (sort readdir(FDIR)) {
    if ($file =~ /PDF$/i) { 
        $filecount++;
        if ($toggle) {
	    $bgcolor = $bgcolor1;
	    $toggle = 0;
        } else {
	    $bgcolor = $bgcolor2;
	    $toggle = 1;
        }
	my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$fsize,$atime,
		$mtime,$ctime,$blksize,$blocks) = stat("$filedir/$file");
	my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($mtime);
	$year += 1900;
	my $ftime = "$year-" . sprintf("%.2d",++$mon) . '-' . sprintf("%.2d",$mday) 
	    . ' ' . sprintf("%.2d",$hour) . ':' . sprintf("%.2d",$min) . ':' . sprintf("%.2d",$sec);
	$body .= Tr(
	    td({-bgcolor=>$bgcolor,-align=>'left'},$file),
	    td({-bgcolor=>$bgcolor,-align=>'right'},$fsize),
	    td({-bgcolor=>$bgcolor,-align=>'right'},$ftime),
	    td({-bgcolor=>$bgcolor,-align=>'right'},"<a href='$file'>Download</a>")
	);
    }
}
closedir FDIR;
if ($filecount) {   # files were found
    $body = Tr(th({-align=>'center'},'File Name'),th('Size (bytes)'),th('Creation Time'),th('Action')) . $body;
} else {	    # no files were found
    $body .= Tr(td({-colspan=>'5',-align=>'center'}, "NO FILES FOUND"));
}
    
# write the page

open (FINDEX, ">$indexdir/$outfile") or die "Cannot open $indexdir/$outfile for writing: $!\n";
print FINDEX start_html(-title=>$title);
print FINDEX p({-align=>'center'},img({-align=>'center',
	-alt=>$logoalt,-src=>"$logo"}));
print FINDEX table({-align=>'center',-border=>'0',-cellpadding=>'5',-cellspacing=>'0'},$body);
print FINDEX end_html;
close FINDEX;


Hope it's something you can use.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
<Navin>
posted
Hi ,

I used the logic given by Tom Flynn...
I wrote unix scripts to find the size and ftp the file and used the script in the Webfocus code.

Thanks all of you for directing me towards a solution.

The suggestions of everyone was of great help and it also helped in gaining more knowlege abt the focus tool.

thanks again
 
Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Finding the size of the PDF report scheduled in ReportCaster.

Copyright © 1996-2020 Information Builders