Jump to content
Changes to the Jaspersoft community edition download ×

adiboing

Members
  • Posts

    22
  • Joined

  • Last visited

adiboing's Achievements

Explorer

Explorer (4/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Yeay I solved it /tools/fckeditor/editor/images/smiley/msn/teeth_smile.gif biggg thanks to you matt! In the end I wasn't able to tell the expression an array of this dateformats which worked. I solved my issue on a bit different way. For every single iReport user. Cast a String to Date worked in my case like this: My Datasource was an Excelfile, all fields were from type String. I have a field with dates in formatting yyyy-MM-dd-HH-mm it is called: $F{Bestelleingang} - (String) To work well with the field I had to convert it into a date within a Variable, this variable is called: $V{dateBestelleing} - (Date) And now the expression to cast my string from the field into a valid date is following: DateUtils.parseDate((new java.lang.String($F{Bestelleingang}.length() > 10 ? $F{Bestelleingang}.substring(8,10) + "/" + $F{Bestelleingang}.substring(5,7) + "/" + $F{Bestelleingang}.substring(0,4) : "01/01/0001")), "dd/MM/yyyy") Out of: yyyy-MM-dd-HH-mm will be: dd/MM/yyyy I know my expression seems kinda wirred and long but its the only way I found. Before I was able to use the DateUtils.parseDate() function I had to add the jar-file from matts website ;) (http://commons.apache.org/lang/download_lang.cgi) Take the commons-lang3-3.0-bin.zip in the category Binaries. And to include it to iReports (I use iReports 4.0.2) go to the Tools -> Options -> Classpath and then Add JAR Don't forget to rightclick into your Report Inspector on your project and go to Properties -> Imports -> include "org.apache.commons.lang3.time.*" (without the quotes) Now you don't have to start your expression with org.apache.commons.lang3.time.DateUtils.parseDate(... If everything workedout you should have a valid date fromated value in a Variable ;) If it was helpfull to someone please give me a karma-point :) peaceout Adi :D Post Edited by adiboing at 07/28/2011 09:07 Post Edited by adiboing at 07/28/2011 09:08
  2. Wow this DateUtils-Class looks very interesting :D, seems like thats what I need somehow thank you matt ;) I recive my data from an excel datasource so I'm not able to define any sql query :( because of that I have so many problems. On your page you talked something about a package? "Don’t forget that you need to import the relevant package. In iReport click on the root report element, and in its properties you’ll find Imports. Add “org.apache.commons.lang.time.*” (without the quotes) as an import." I'm not really used to this java stuff. But I think I have to get something like a .jar file or something which contains this DateUtils-Class. Cause it doesn't seems like my iReports knows this DateUtils yet. Its the same with this SimpleDateFormat. I tried your stuff from your webpage and it didn't worked and I thought that it can't work until you "teach" iReports how to use DateUtils. So I searched for a .jar file in the internet and found this: http://findjar.com/jar/commons-lang/jars/commons-lang-2.3.jar.html I downloaded it and added the jar under the options in iReports. Okay now your example.jrxml is working but not all expressions. The "getFragment..." and the "setDay..." functions are not working and are throwing errors. So I deleted those till I was able to compile your example. So I played a bit with your expressions and then tried to use the parseDate() function which I need. But somehow its not working as the 2 functions I told you above :( I have added a second Parameter called: $P{stringDate} - datatype: String and a Variable called: $V{getDate} - datatype: Date My expression for the variable getDate is the following: DateUtils.parseDate($P{stringDate}, "dd-MM-yyyy") and the parseDate function should look like this: parseDate(java.lang.String str, java.lang.String[] parsePatterns) My problem seems to be that I'm not using a String[] Here is the error I recive: 1. The method parseDate(String, String[]) in the type DateUtils is not applicable for the arguments (String, String) value = (java.util.Date)(DateUtils.parseDate(((java.lang.String)parameter_stringDate.getValue()), "dd-MM-yyyy")); //$JR_EXPR_ID=9$ <-------> And now I don't now how to go on :( could you give me an example? Cause it seems that this is the only function to achieve a Date out of a String =/ Hope you can help me again :D Looking forward to your answer. Greetz Adi ;) PS: All I need is a Variable (Type: Date) with a date from a field (Type: String) When my Parameter is set to 01/01/0001 I can use the following to change this date into 01/01/2001, but the expression only works in a textfield and not in a variable what doesn't makes any sense to me. Why textfield and not variable, too? DateUtils.addYears($P{MyDate},(2001-1)) Post Edited by adiboing at 07/25/2011 10:12
  3. Hey mdahlman :) When I look into the properties of the Variable pureInt I can see the functions parseInt(String), intValue() and decode(String), getInteger(String). All I changed was that I started my expression with the Variablename $V{pureInt} and not with Integer.parseInt(...). But still none of these functions is working. Everyone prints a "null". $V{pureInt}.parseInt($V{blanknums}) $V{pureInt}.intValue($V{blanknums}) $V{pureInt}.getInteger($V{blanknums}) $V{pureInt}.decode($V{blanknums}) and not even when I try this: new Integer($V{pureInt}.parseInt($V{blanknums})) or new java.lang.Integer($V{pureInt}.parseInt($V{blanknums})) all I get is "null".... http://img171.imageshack.us/img171/3928/stringint.png My real goal to achive is actually to convert a field from type string which includes a date (yyyy-MM-dd) to have it in a varibale form the datatype date. Thats why I also asked about this SimpleDateFromat thing. With this conversion from string to int I just searched a way to get this integer into a date... because I'm not able with a string to get it as an date... and not even this parseInt() is working... what is wrong with my iReports :(? please help, Adi
  4. Hey guys :) I have a little question. When I have a Variable lets say $V{Integer} and a Field $F{String}. The names are also their datatypes. ;) And now when I would like to convert from the $F{String} which only includes numbers into $V{Integer} I don't now how. When I try some of the expressions which I found here in the forum I just recive errors. Integer.praseInt($F{String}) Integer.intValue($F{String}) Integer.toInteger($F{String}) And when I press CTRL + Blankspace at the dot I can't find any of these functions or even in the right area where I marked the red arrow. They aren't there, and I just get an Error (also in the picture) :( http://img43.imageshack.us/img43/7729/functions.png So can anybody tell me what I have to do to include for example those java functions that I'm able to select one of those? And additional how can I use the java.text.SimpleDateFormat? I use iReport 4.0.2 and Groovy Somehow it has to be able because I wrote alot about people who use one of these functions :D peace Adi ;)
  5. Hey guys, please I need a solution about that but I'm not able to find it on my own :( I tried so many ways but nothings working... You can't tell me that nobody knows how to convert a string field from a datasource into a .data type... anybody should now this =/
  6. Nope thats not my problem :) Allright here you can see my Excel Datasource. The red marked area are date formated cells (yyyy-MM-dd) When I get this field via iReport its a normal stringtype field. So now I would like to get the difference of these dates in days. (Just to be clear: the word "Tage" in my first screenshot is a normal Static Label from iReport and this word is german and means days :D) The difference is 8 days and 39 days ;) BUT: I wasn't able to convert the datefield which is type string to a valid date format. It only works in a textfield with expression in my first post. So I'm able to convert the stringtype dates from the excel field in a textfield to a dateformat. And I'm able to substract those in a textfield. When I try to convert the datefields from stringtype to datetype with a Variable its not working, I recive errors. But I need the dates in a variable to work with them :( So long story short: Dates(stringtype) -> per textfield -> Dates(datetype) <-- working Dates(stringtype) -> per variable-> Dates(datetype) <-- not working, I get errors To calculate with the dates I need to have them in a variable :( Do you understand my problem now?
  7. Nobody has an idea? Or is my explantation to bad to understand :(? Please help or just say something ^^
  8. How about this. Create a Variable call it for example sumPBL. Click on properties: Variable Class: Integer Calculation: Sum Reset Type: Group Reset Group: (Your Group you created) Variable Expression: $F{PBL} Place this Variable called sumPBL in you Group Footer Band. This will sum all values from the field PBL of each group. Hope this was clear enough peace Adi
  9. Hello guys, I use a Excel Datasource File, there are all string type fields. I had to change a date column in excel to the format yyyy-mm-dd to be able to convert it with a Textfield to a java.util.Date: Expression: new Date ($F{MyDate}.replace("-","/")) Now I am able to show the fieldoutput as a valid date formatting. BUT, now I compare to dates and substract those. I'm able to get the difference as an Integer with this Expression: new Integer(new Date($F{Datum TR 01}.replace("-","/")) - new Date($F{Bestelleingang}.replace("-","/"))) <---- this integer is also in a Textfield Know I have some Integer values into a Textfield. But I'm not able to SUM those integers together because I get an error when I try to write the same expression for the Integers in a Variable. EDIT: Here I add a picture for better understanding (Sry but somehow I wasn't able to include it directly) http://imageshack.us/photo/my-images/27/sumdate.png/ Anybody can help me? Post Edited by adiboing at 07/13/2011 06:59
  10. @rashmi_prabhu: I also asked this once in a thread, but nobody cares... All I now is that you can copy your second sheet information into a seperate excel file and use this as another datasource.
  11. Question is my sugesstion right that I can implement more functions to iReports Expression? I found the function praseInt() but this function and others like, .getInteger(String) or valueOf(String) is just returning an null.... do you know why? Thats my expression in the properties of a Variable called intTest... and the field Gesamt Brutto is a String containing numbers as string...: $V{intTest}.parseInt($F{Gesamt Brutto}) $V{intTest}.valueOf($F{Gesamt Brutto}) $V{intTest}.getInteger($F{Gesamt Brutto}) everything is not working... I'm using Groovy =/ Post Edited by adiboing at 06/27/2011 07:00
  12. Hello dudes, this is another thread from me, maybe I solve it like the others by myself but actually this time I'm almost about to quite.... I searched the web for a propper instruction about a, how to use ireports with a excel datasource, futile... My problem is that each field has the datatype String. Alright lets change the datatype in the fieldproperty to, lets say integer, futile... I don't know why its not working like it should, but I created a video to show you my problem precisely. All you got to do is unzip my attached file and start the .html file. A video will start and show my display with ireports. For explantation while the vid is running. 1. In the beginning you'll see how I get the fields all as String. Important are the fields "ID" and "Gesamt Brutto". (Some names are written in german but don't bother). 2.Then I change the field "ID" to type Integer. This is working well. In Excel the column "ID" has "Standart" formatting with just numbers 1,2,3....per cell. 3. Now I change the field "Gesamt Brutto" to a float type. In Excel this column has the formatting "Numeric". When I preview my report a error occures. When I change the type to integer, same scenario. When I use it as normal String type, everything is working. 4. Additional Question: When I preview my report after the typecast back to string I mark 3 rows with the mouse. These rows have all the same name "Hirschmann". How can I create a var or something to check if the last value of a field is the same as the present. Because I would like to sum the "Gesamt Brutto" when the name is the same. So when theres three times "Hirschmann" do '6.484 + 24.023 + 84.390'. Anybody got an idea? 5. End Hope anybody can help me now... not like the other times =/ peace Adi
  13. Alright I solved my issue again on myself :P Actually it is easy to see the issue if you now how to create a chart right, so at this place, thanks to anyone who looked in this topic and didn't posted the answer.... Don't get confused I changed from "Name" & "Total" to "Month" and "Days" All I had to do was to write new String ($F{Month}), new Double ($F{Days}) thats it.... here some pics for the understanding: http://www.bilder-hochladen.net/files/9b2l-9g.png http://www.bilder-hochladen.net/files/9b2l-9e.png http://www.bilder-hochladen.net/files/9b2l-9f.png but I have 2 other questions: 1. When I have a Excel Datasource File and this file contains more then one table. Is it possible to switch between this tables? Or do I have to put the table on first place to use that one that I like? 2. When I get the values from the fields of an Excel Datasource then every field is a String type. Even if its a Number in Excel with a ", " and a dot for the thousend numbers like that. 8.924,50 <---- iReport can't do anything with this number. I have to format it like this 8924. But then I miss my ,50. And its not possible to say the chart us it as new Float. Does anybody has a tip or something ;)? peace Adi Post Edited by adiboing at 06/21/2011 06:58
  14. Hey guys, I'm trying to create 2 charts. Here is my datasource file from excel: http://www.bilder-hochladen.net/files/9b2l-9b.png From Eaten till Pizza should be a Bar Chart and Name and Total a Pie Chart. Now my problem is. When I tried to insert the $F{Eaten}, $F{Who}, $F{Pizza} it won't work to create the Bar Chart. It says there are errors at Eaten. So it tried and tried and finaly it worked when I inserted all values one by one... (picture below) http://www.bilder-hochladen.net/files/9b2l-9a.png This is the chart with my manuel typed values. http://www.bilder-hochladen.net/files/9b2l-9d.png Okay that sucks but it works somehow.... And my Pie Chart with Name and Total sounds easy with just the few values, but... http://www.bilder-hochladen.net/files/9b2l-9c.png when I include those fields it shows me an error at total... and as you've seen on top of this topic, in total are normal numeric values.... So do you guys have a clue why both charts are not working with the values from my excel datasource? In the Detail-Band it shows all values.. please help =/ peace Adi
  15. Code:not working oOCode:[code]I can't write a dumb Message, what the hell -.-okay crap on it! i write here..I sry but ireports is not very user friendly. all i have to do is to count different stringsI get STATEs as a String from my DB and they include for EXAMPLENEWTESTEDUNTESTEDso those states where listed, and now I would like to know how many NEW-States how many TESTED-States and UNTESTED-States are displayed.so when $F{TEXTFIELD} = ($F{STATE}.equals("NEW") ++1 or something like that.but I'm not able to do this and I have done many stuff with programming software... sry but ireports is not so easy to understand in the beginning...oh and why couldnt i write this message in the message field? it was gray... Post Edited by adiboing at 06/16/2011 11:13 Code:[code]I solved the problem by myself please close, but tell me why I'm not able to write in the "Message:" textfield. Post Edited by adiboing at 06/16/2011 12:13
×
×
  • Create New...