Jump to content
We've recently updated our Privacy Statement, available here ×

bobtins

Members
  • Posts

    32
  • Joined

  • Last visited

bobtins's Achievements

  1. The attribute "compressableMimeType" should be "compressibleMimeType". https://tomcat.apache.org/tomcat-8.5-doc/config/http.html
  2. I'd like to explain the origin of the problem in more depth. The workaround, which is to install JR Server in a directory with a shorter path, is still valid. I also thought that the 260 character limit was the culprit; however, this is confusing because in later versions of Windows, including Windows 10, this restriction has been lifted. Also, this can happen when none of the paths exceed 260 characters. It turns out that there is still a limit of 32,768 bytes on the size of the entire command line. This seems like a lot, but during the installation, an import process is started which includes a list of all the JARs in the directory <JRS_INSTALL>/buildomatic/conf_source/iePro/lib. In JRS 6.4, the count of JARs is approximately 304, so it's pretty easy to go over this limit. Previous versions of JRS had fewer JARs, so it was possible to have a longer path without hitting this error. The easiest workaround is still to install JRS on a shorter path; an issue has been filed to lift this limitation in a future version of JRS.
  3. Actually, the very last formatting option, which just shows three places, will actually show from three to sixteen, but the number used as an example only has two decimal places. Here are some more details if the provided formats are not enough: You can do further configuration of formatting in Ad Hoc by modifying the file WEB-INF/bundles/adhoc_masks.properties. Here are the formats for decimal types: ADH_100_MASK_dec_0 = #,##0.00ADH_100_MASK_dec_1 = 0ADH_100_MASK_dec_2 = $#,##0.00;($#,##0.00)ADH_100_MASK_dec_3 = $#,##0;($#,##0)ADH_100_MASK_dec_4 = $#,##0.000############# Decimal formats are specified by the Java DecimalFormat class; here's some documentation: https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html
  4. The definition of the Mid function is in the form of a Groovy language snippet which is part of the SQLGenerator bean. This definition is in WEB-INF/applicationContext-semanticLayer.xml. There is a defaultSQLGenerator bean which defines the Mid function this way: <entry key="Mid"> <value>"substr(" + sqlArgs[0] + ", " + sqlArgs[1] + (sqlArgs.size() == 3 ? (", " + sqlArgs[2]) : "") + ")"</value> </entry>[/code]If you only need to get Redshift working for domains, then you can change this default definition so it uses "substring" instead of "substr". If you need to get other data sources working, then this config change may affect the Mid function for other datasources, and you would have to configure a Redshift-specific SQLGenerator. Try changing the default and see how that works.
  5. Just wondering more about the dependency issue. Is it that there are too many, or it's difficult to make sure you have them all? The project is Maven-based, but I see there aren't any instructions for building from source. Is there anything that would make it easier to get going with this library?
  6. /scratches head OK, that's weird... I wish I could reproduce what you're seeing--thanks for trying this under a number of different circumstances. The web page runs some code to getting info from the repository on what the current user can do with each resource, and this gets translated into parts of the UI, including menus and the around the resource name that lets you click and run it. So somewhere this is going wrong. When you tried with joeuser, what were the perms for joeuser on the root folder and the test folder?
  7. @tbuterbaugh: That's a good idea--if the 5.2 JR server is available, I would confirm that it works there to rule out other causes for the problem. However, we have seen an issue with a similar error message (java.lang.RuntimeException: overwriting expression 'null'...) on upgrade to 5.5. In that case, the Ad Hoc view used a topic in which one field name contained a space, which was OK in 5.2. If this view still works in 5.2, we'd like to get some more information (if you don't mind sharing it) so that we can investigate. Could you export the Ad Hoc view that's causing a problem? This needs to be done by logging in as "superuser"; instructions can be found in the online doc here: http://support.jaspersoft.com/Docs/viewDocument.php?doc_id=184342507&start_page=119&nav=true Thanks!
  8. I tried to duplicate your issue with the sample "joeuser" user. I created a new role "testrole" with "joeuser" as a member, then I created a folder with read-only permissions for "testrole". I copied a report into that folder, and joeuser could run it. As jasperadmin, I scheduled the same report with PDF output into the read-only folder. When I logged back in as joeuser, I could see and run the PDF output. It looks like this works for me, so can you explain more about what happens? It sounds like you can see the PDF as a Content Resource, but what happens when you click on it?
  9. Are you setting the attributes with the Manage Users admin page? How are you accessing the attributes?
  10. Thanks, this is a good example of something we should be able to support in the product. We are implementing an expansion of the calculated fields capabilities in Ad Hoc for next release, and one thing I would like to enhance is the way we handle summary calculations. Currently, we just allow the user to specify a function, but for cases like this, the user should be allowed to have full control over how to calculate the summary. A few releases back, we did make a change so that the sum of a calculated field "a/b" would be "sum(a)/sum(b)". The formula that you want for the summary is actually "1 - sum(discount)/sum(retail)". I put your sample data into a database and tried it out. What I found was that the summary for "discount/retail" comes out as "sum(discount)/sum(retail)", but not summary for "1 - discount/retail" is really "sum(1 - discount/retail)", which is not correct. Thanks again for bringing this up. Often we are trying to strike a balance between ease of use and power in designing the user interface. In cases like this, users have a good idea of what to do, and we should figure out how to get out of the way and let them do it!
  11. That's interesting, I've been just looking into the same issue... I researched the existing XML datasources and query executers. Here's a good description of how to use them. It seems like there are two ways to get an XML datasource from a URL using JR standalone (without JR Server): 1. create datasource directly - create a JRXmlDataSource by passing the URL to the constructor - pass the datasource in the "REPORT_DATA_SOURCE" parameter 2. use one of the query executers - fetch the contents of the URL and parse it into an org.w3c.xml.Document - create a query in your JRXML with language set to "xPath" and a queryString containing the XPath of the elements you want to iterate over - pass the document object in the "XML_DATA_DOCUMENT" parameter In either of these cases, you need to have some Java code for setup--either building the JRXmlDatasource or parsing the XML. In JRServer, you would have to do this with a custom data source. One of the sample custom data sources (under samples/customDataSource in the JRServer install directory) is the so-called "webscraper" datasource. It's very similar to the XML query executer and data source. It can take the URL of an HTML page, fetch it, turn it into XML, and use an XPath to get a list of elements. I haven't tried it on an XML, but it might just work. The good thing about this implementation is that you can use it in JR Server either with or without a custom data source instance, because it can get the URL and XPath right from the queryString. If you want to check this out, you can get info about custom data sources (including the samples) in the JR Server doc, and there is also a readme.txt under samples/customDataSource. Here is the info from that file describing the Webscraper sample: Webscraper Custom Data Source The webscraper custom data source implementation can fetch a web page, decode the HTML, and extract selected data which is turned into field values in the data source. Its Spring bean definition file is located in <js-install>/samples/customDataSource/webapp/WEB-INF/applicationContext-webscraperDS.xml. These are the configuration items for the datasource: URL: An HTTP URL which refers to the HTML page containing the desired content DOM path: An XPath expression which locates HTML elements to be turned into rows in the data source Field paths: XPath expressions for each field defined in the JRXML which are used to locate the field value within each row selected by the DOM path The implementation creates a data source by taking the following steps: Uses the URL to issue a GET request for an HTML page. Converts the HTML response into XML using JTidy (http://jtidy.sourceforge.net). Uses the DOM path to select XML elements from the converted response. Create a new data source row for each selected element For each field, use the field path to determine the content for each field The data source has two parameters: the URL of the web page, and the XPath that selects the elements in the HTML page which will become rows in the data source. The parameters can be specified either by a data source definition in the repository or by a query string in the JRXML.The example reports for this data source read a web page from http://www.craigslist.org and extract a list of items for sale. The file reports/webscrapertest.jrxml has no query defined. Instead, it relies on an instance of the custom data source that has been created in the repository. Typical parameters to use with this data source are: URL: http://sfbay.craigslist.org/sfc/cta/ DOM Path: /html/body/blockquote[2]/div/pThe file reports/webscraperQEtest.jrxml contains a queryString element which specifies the URL and the DOM path. It should be used without defining a data source instance, because JasperServer will not run the query executer for this particular implementation if a data source is defined for the report unit. I hope this is useful for you! Let me know if you have any questions. Post Edited by bobtins at 07/18/2011 20:13 Post Edited by bobtins at 07/18/2011 20:15
  12. FWIW, I dug into this a little bit to figure out just how the order of input controls is determined. If the order of the input controls is really bugging you and you don't mind getting your hands dirty, you can change the order using SQL. Hibernate lets you map an ordered list of objects, and report units use this mapping for their input controls. The mapping from report unit to input control is stored in the table "JIReportUnitInputControl", and it has the id for the report unit, the input control, AND an index which determines the order of the input controls. You can update the index (column control_index) to change the order, but because control_index is part of the primary key, you can't just swap one by one because at some point you will have duplicate values. See below for how I swapped the two input controls with a couple update statements. See the attached screen shot for the result--not that useful, but it demonstrates the functionality! Practically, this means that we already have the hooks to do this; we just have to implement a way to change the order of the list in the repository and surface it in the web UI and web services. Code:mysql> desc jireportunitinputcontrol;+------------------+------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+------------------+------------+------+-----+---------+-------+| report_unit_id | bigint(20) | NO | PRI | NULL | || input_control_id | bigint(20) | NO | MUL | NULL | || control_index | int(11) | NO | PRI | NULL | |+------------------+------------+------+-----+---------+-------+3 rows in set (0.00 sec)mysql> select * from jireportunitinputcontrol where report_unit_id = 2197;+----------------+------------------+---------------+| report_unit_id | input_control_id | control_index |+----------------+------------------+---------------+| 2197 | 2195 | 0 || 2197 | 2196 | 1 |+----------------+------------------+---------------+2 rows in set (0.00 sec)mysql> update jireportunitinputcontrol set control_index = (3 + control_index) where report_unit_id = 2197;Query OK, 2 rows affected (0.00 sec)Rows matched: 2 Changed: 2 Warnings: 0mysql> select * from jireportunitinputcontrol where report_unit_id = 2197;+----------------+------------------+---------------+| report_unit_id | input_control_id | control_index |+----------------+------------------+---------------+| 2197 | 2195 | 3 || 2197 | 2196 | 4 |+----------------+------------------+---------------+2 rows in set (0.00 sec)mysql> update jireportunitinputcontrol set control_index = (control_index % 2) where report_unit_id= 2197;Query OK, 2 rows affected (0.02 sec)Rows matched: 2 Changed: 2 Warnings: 0mysql> select * from jireportunitinputcontrol where report_unit_id = 2197;+----------------+------------------+---------------+| report_unit_id | input_control_id | control_index |+----------------+------------------+---------------+| 2197 | 2196 | 0 || 2197 | 2195 | 1 |+----------------+------------------+---------------+2 rows in set (0.00 sec)
  13. JR supports Hibernate queries (with language "hql") with the JRHibernateQueryExecuterFactory. If you compile a JRXML with this kind of query and want to run the report with a standalone program, you need to instantiate a Hibernate SessionFactory and pass it to the JR filler using the "HIBERNATE_SESSION" parameter. In JasperServer, it's up to the ReportDataSource to do this, but out of the box, we only support bean, JDBC, and JNDI versions of ReportDataSource. There is actually a Hibernate custom data source in the "samples/customDataSource" directory, along with two other custom data sources. The Hibernate data source was added later and the doc on custom data sources (JasperServer User's Guide section 6.1) doesn't cover it. The Java source files and Spring config files for the implementation also have some helpful comments. To get started using the Hibernate custom data source, I'd do the following steps: Make sure that the Hibernate SessionFactory that you want to use is set up by doing one of the following: Configure a named Spring bean with class SessionFactory or HibernateDaoSupport in a Spring application context file (WEB-INF/applicationContext-<something>.xml) Configure a default session factory using the Hibernate-specific config file in WEB-INF/classes/hibernate.cfg.xml (one is included in the sample directory) Do nothing if you want to use JasperServer's repository session factory (spring bean name is "sessionFactory") Follow the instructions in the User's Guide section 6.1 to install the samples in your JasperServer webapp Restart your app server Log in as an admin and create a data source; you should now have the choice of Hibernate Data Source, so pick that For Session Factory Bean Name: If you created a SessionFactory as a named Spring bean, enter the name of that bean If you use hibernate.cfg.xml, leave it blank If you want to use JasperServer's session factory, enter "sessionFactory" You should now be able to create a report unit with JasperServer or with iReport's JasperServer plugin, using your newly created data source
  14. This recently came up as a customer support issue, so I did a little research on it. I looked into this a little bit--there are a couple parts to what the customer wants. First is getting this to work in JasperServer. If you wanted to set a server-wide default format factory by passing in the parameter to every report, you could add a new BuiltInParameterProvider to the array in applicationContext.xml: <bean id="builtInParameterProviders" class="java.util.ArrayList"> <constructor-arg> <list> <bean class="com.jaspersoft.jasperserver.api.engine.jasperreports.util.UserProfileBuiltInParameterProvider"/> </list> </constructor-arg> </bean> The source code of the UserProfileBuiltInParameterProvider has some more explanation of how it works. There may also be some mechanism in JR to configure the default format factory through jasperreports.properties. Second, how would you actually implement the new format factory in Java 5 or 6? In either case you would start by subclassing DefaultFormatFactory. Java 6 is easier--you can take the formatter returned from the superclass createNumberFormat() and set the rounding mode. Java 5 is a little harder but not impossible. You would get the formatter returned from the superclass createNumberFormat(), then create a wrapper that implements format() by converting the number into a BigDecimal and doing the correct rounding on it (you would have to look at the DecimalFormat to see how many decimal places it contains). Here's a good link for understanding rounding modes: http://www.javabeat.net/tips/35-precise-rounding-of-decimals-using-rounding-m.html Post Edited by bobtins at 09/20/2010 16:48
×
×
  • Create New...