Posts Tagged ‘scripting’

In this post we look at how text data can be transposed in a shell script. Suppose you have a comma-delimited text file (csv) which looks like this: 2014-10-01,Reading1,20.3 2014-10-01,Reading2,21.5 2014-10-01,Reading3,24.0 2014-10-01,Reading4,22.2 2014-10-02,Reading1,20.5 2014-10-02,Reading2,21.5 2014-10-02,Reading3,24.1 2014-10-02,Reading4,22.4 2014-10-03,Reading1,20.5 2014-10-03,Reading2,21.7 2014-10-03,Reading3,24.2 2014-10-03,Reading4,22.5 …and so on. Perhaps this is a set of sensor readings over a period of […]

Saturday, October 18th, 2014 at 15:50 | 0 comments
Categories: Linux

Suppose you have a monthly process to archive some data such as log files etc. Each month a separate archive file is created, and so after a few months you will have several archive files – for example as shown below: archive.2014-08.tar.gz archive.2014-09.tar.gz archive.2014.10.tar.gz Now if you wish to extract your data from all three […]

Saturday, October 18th, 2014 at 07:48 | 0 comments
Categories: Linux

Sometimes it may be useful to know inside the report which servlet mapping is used to run the report (e.g. frameset, run, preview). var sMapping = reportContext.getHttpServletRequest.getRequestURI(); var nPos = sMapping.lastIndexOf( “/” ) + 1; this.text = sMapping.substring( nPos ); You can place the above code inside a label to see the servlet mapping.

Thursday, August 11th, 2011 at 02:32 | 0 comments

In an earlier post we discussed a generic way to dynamically get the list of report parameters at run time without having to hardcode the parameter names in the script. As was correctly pointed out in the comments, the code did not work for parameter groups (and also cascading parameters). However, it is possible to […]

Thursday, June 9th, 2011 at 16:57 | 0 comments

UPDATE: For an improved version of the code which works correctly with parameter groups and cascading parameters please see this updated post. Thank you to Stork for pointing out the problem with this code. The traditional way of accessing BIRT report parameters from script is through the expression ReportContext.getParameterValue( parameterName ). Naturally this method requires […]

Thursday, November 18th, 2010 at 14:42 | 4 comments