prabhudar Posted October 20, 2009 Share Posted October 20, 2009 Hi,I have one problem, in our report development one requirement is like when loc_id is "" then print "N/A" else loc_id is having values like '002530' and need to printed like '2530' , I cant use substring as '002530' can be '0002530' also so I want to convert this to integer and to display , I used new Integer(parseInt.(str)) but then it is giving me error can not cast string to integer , can you guide me on this ? -Thanks & RegardsDarshan Link to comment Share on other sites More sharing options...
englbrechtful Posted October 20, 2009 Share Posted October 20, 2009 Hi,new Integer(Integer.valueOf($F{loc_id})) This should work, assuming your loc_id field is called $F{loc_id}.To get the N/A thing working you could use this:$F{loc_id} == "" ? new String("N/A") : new Integer(Integer.valueOf($F{loc_id}))(i.e. if string = "" then print new String N/A, else print integer value of string) Stefan Post Edited by englbrechtful at 10/20/2009 13:00 Link to comment Share on other sites More sharing options...
edalmebo65 Posted February 6, 2015 Share Posted February 6, 2015 Funciona perfecto al hacer este if: new Integer(Integer.valueOf($F{CALIFICACION PROMEDIO}) > 0 ? Integer.valueOf($F{CALIFICACION PROMEDIO}) : 0 ) 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