jkeri Posted April 18, 2018 Share Posted April 18, 2018 in my Excel sheet i have an AMOUNT field. The cell is defined /formatted as a NUMBER. The first line in the EXCEL is the header with the column headings. Data starts on the second line.In my jasper repoprt , by default, the AMOUNT field is defined as 'java.lang.String'. When I run the report i keep getting 'net.sf.jasperreports.engine.JRException: Unable to get value for Excel field "AMOUNT" of class java.lang.String' error. I have tried all other types of classes, ; big decimal, integer, long.,short, float, none of them seem to work.Anyone have any idea as to what class i should assign to the AMOUNT filed? Link to comment Share on other sites More sharing options...
hozawa Posted April 18, 2018 Share Posted April 18, 2018 When creating a Data Adapter, there's a "Skip the first line (the column names will be read from the first line)" check box. Check that to skip the first line. Link to comment Share on other sites More sharing options...
jkeri Posted April 19, 2018 Author Share Posted April 19, 2018 Ok,, here is what i did for the AMOUNT field. I chnaged it from class type 'java.lang.String' to 'java.lang.Integer'. This works!!!!Now I have the same type of issue with a date field.It is defined in EXCEL as 'CUSTOM' with a mask of' m/d/yyyy h:mm:ss AM/PM'. I am not sure what the Class Type would be in Jasper. I tried 'java.sql.Date' and a pattern of' MM/DD/yyyy'. Any suggestions? Link to comment Share on other sites More sharing options...
j.seyfriedxiiix.de Posted April 25, 2019 Share Posted April 25, 2019 I've got the same issue. Whats weird is, that the data preview works fine, but when generating the report then the error still returns. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now