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

dknutson

Members
  • Posts

    30
  • Joined

  • Last visited

dknutson's Achievements

Contributor

Contributor (5/14)

  • First Post Rare
  • Collaborator Rare
  • Conversation Starter Rare
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. That's how to change it in the report using iReports. I need to know how to do this in the input control. What I actually will need later on is much more involved than a simple default date, but I thought that figuring out how to set that in the input control would be a good place to learn how to make a custom input.
  2. I need to have a fairly simple custom input control created for JasperReports CE 4.5. My reports would use parameters pStartDate and pEndDate. The control would offer up a list of possible choices, such as Today Yesterday Week to date and it would return a start date and end date based on the selected entry. The default for this input would be 'Yesterday'. This needs to work with scheduled reports also. If interested, please email me with your requirements.
  3. I need to have a date parameter that will default to yesterday. I've read a number of post on creating custom input controls, and I've dug into the DefaultParametersForm.jsp. I've even purchased the latest version of the Jasperserver Ultimate Guide. I'm just not getting it. Does anyone have a form sample that set's a default date?
  4. Is it possible to disable the requirement for an output location when you schedule a report? I plan to only deliver report to users via emailed pdfs.
  5. Considering using Jasperserver, but will need to create a custom input page for a week parameter. In our calendar, the first day of the week starts on Thursday. We also go by Periods instead of months, so Period 9 week 4 starts on 3/15/12 and ends on 3/21/12 - and is also reference by the subperiod ID = 742. I've seen instructions for creating a custom input page. My question is about report scheduling. Say I've got a report that provides data by subperiod. I want it scheduled so that it always returns data for the previous subperiod. How would I do that? Do I need to write a custom scheduler, or do I do this in SQL?
  6. Not sure if this is a bug or what. My system is JasperServer 3.7 and iReports 3.7. I'm using the parameter $P{LoggedInUsername} to get the name of the user logged into Jasperserver. This works just fine, unless I set a default value for the parameter. Jasperserver will only return the name if a default hasn't been set. My problem is that once I set a default on this parameter the only way to get it to work properly again is to edit the file's XML entries. If I simply delete the value from the iReports designer screen it left this in the XML - <defaultValueExpression><![CDATA[]]></defaultValueExpression> And Jasperserver is seeing this as a default value of NULL. I have to delete this from the XML before it will work. So, bug or something wrong with my iReports?
  7. Amazing what a new day will bring. After sleeping on it I found what was causing the problem. When you set a default for LoggedInUsername, the following entry is created in XML - <parameter name="LoggedInUsername" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA['TEST"]]></defaultValueExpression> </parameter> Now, if I delete the default value of "TEST", iReports still leaves the string <defaultValueExpression><![CDATA[]]></defaultValueExpression> Jasperserver is seeing this as being a default value set to NULL and uses that instead of the login name. If I delete this string, then everything works.
  8. Folks, I'm completing stuck. I'm using the parameter $P{LoggedInUsername} in a very simple report. I've actually tried this both ways - once using only $P{LoggedInUsername} and also by using the 2 parameters $P{LoggedInUser} and $P{LoggedInUsername}. Both fail in the same way. I've included the xml for both reports. Here is what happens. I create report1 and it works! It shows the user login name and returns the correct values from the query. Then I edit the report to add another field to the query. The report stops working because it now returns a NULL for the login name. It's not the query as the report does the same thing even if I hardcode the login name. HELP! Report 1 - the working report <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="test2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <parameter name="LoggedInUserName" class="java.lang.String"> <defaultValueExpression><![CDATA["DMKtest"]]></defaultValueExpression> </parameter> <parameter name="LoggedInUsername" class="java.lang.String"/> <queryString> <![CDATA[select sd.storeid from bkdata.dbo.storedata sd inner join jasperreports.dbo.selectstores ss on sd.storeid = ss.storeid and ss.userid = $P{LoggedInUsername}]]> </queryString> <field name="storeid" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <background> <band/> </background> <title> <band height="19"/> </title> <pageHeader> <band height="14"/> </pageHeader> <columnHeader> <band height="61"> <textField> <reportElement x="51" y="21" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$P{LoggedInUsername}]]></textFieldExpression> </textField> </band> </columnHeader> <detail> <band height="25"> <textField> <reportElement x="51" y="0" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{storeid}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="45"/> </columnFooter> <pageFooter> <band height="54"/> </pageFooter> <summary> <band height="42"/> </summary> </jasperReport> The bad report - <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="test3" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <parameter name="LoggedInUserName" class="java.lang.String"> <defaultValueExpression><![CDATA["DMKtest"]]></defaultValueExpression> </parameter> <parameter name="LoggedInUsername" class="java.lang.String"> <defaultValueExpression><![CDATA[]]></defaultValueExpression> </parameter> <queryString> <![CDATA[select sd.district, sd.storeid from bkdata.dbo.storedata sd inner join jasperreports.dbo.selectstores ss on sd.storeid = ss.storeid and ss.userid = $P{LoggedInUsername}]]> </queryString> <field name="district" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="storeid" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <background> <band/> </background> <title> <band height="19"/> </title> <pageHeader> <band height="14"/> </pageHeader> <columnHeader> <band height="61"> <textField> <reportElement x="51" y="21" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$P{LoggedInUsername}]]></textFieldExpression> </textField> </band> </columnHeader> <detail> <band height="25"> <textField> <reportElement x="51" y="0" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{storeid}]]></textFieldExpression> </textField> <textField> <reportElement x="174" y="0" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{district}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="45"/> </columnFooter> <pageFooter> <band height="54"/> </pageFooter> <summary> <band height="42"/> </summary> </jasperReport> Post Edited by dknutson at 01/17/2010 17:55
  9. I just loaded up a 3.5 Jasperserver and tested this. I logged in as userid = DMKTest. It's giving me the current default for LoggedInUsername "DMK" not the userid. Any idea why?
  10. Thanks - that clears up something. A few months back I tried this with 3.5 and had no problems. With 3.7 it doesn't work. I think I'll reload 3.5.
  11. How exactly are you useing "LoggedInUsername" and what do you mean by eliminates one parameter? I've tried using it by itself setup as you describe and it come up null. I've gotten it to work where LoggedInUsername references a second parameter containing LoggedInUser.getUserName(), but at this time I can't get the parameter to work in a query.
  12. Thanks for the reply. I was thinking that if I copy the correct jar to the iReports lib folder, then set LoggedInUser with a default, it should work. Problem is I'm not sure of which jar and where to put it - iReports or Java folder
  13. I've read all the entries related to how to use a user login in a report, but I'm missing something. I've got 3.7 verson of jasperserver and the 3.6 version of iReports. Most of the posts related to this say that you need to create 2 parameters. In iReports I've created a parameter LoggedInUser and set the Parameter Class to com.jaspersoft.jasperserver.api.metadata.user.domain.User and with a default value expression = Test Then I create a second parameter UserID and give it a default value expression of $P{LoggedInUser}.getFullName() The report has only one element - a text field to show the value of UserID. When compiled I get the error - ClassNotFoundException: com.jaspersoft.jasperserver.api.metadata.user.domain.User Can anyone tell me what I'm doing wrong?? Here is the XML - <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="LoginNameTest" language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User" isForPrompting="false"> <defaultValueExpression><![CDATA[aaa]]></defaultValueExpression> </parameter> <parameter name="UserID" class="java.lang.String"> <defaultValueExpression><![CDATA[$P{LoggedInUser}.getFullName()]]></defaultValueExpression> </parameter> <background> <band/> </background> <title> <band height="79"/> </title> <pageHeader> <band height="35"/> </pageHeader> <columnHeader> <band height="61"/> </columnHeader> <detail> <band height="125"> <textField> <reportElement x="247" y="58" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$P{UserID}.toString()]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="45"/> </columnFooter> <pageFooter> <band height="54"/> </pageFooter> <summary> <band height="42"/> </summary> </jasperReport>
  14. I'm running jasperserver 3.7 and have created reports using iReports 3.6. The reports are formated so they print well in PDF format. Problem is, when I run the report from the server, the page initially loads as html and the font size is so small as to be unreadable. What do I need to do to address this problem? Is there a setting somewhere that will control the page and is this in jasperserver or in iReports? Thanks!
×
×
  • Create New...