?
Solved

I get an error saying "The left-hand side of an assignment must be a variable" while compiling report in Jasper Report

Posted on 2014-11-06
3
Medium Priority
?
576 Views
Last Modified: 2014-12-01
Hi,
I am working on editing a Jasper report. When I assign a double value to a variable which is of type double, I am getting the following error during compilation:

The left-hand side of an assignment must be a variable             (((java.lang.Double)variable_slabSum.getValue())=new Double(0.0) && (((java.lang.Double)field_percent.getValue()) + " of first " + ((java.lang.Double)field_slab_end.getValue()))

"slabSum" is a variable created of type double and I am trying to assign a value of "0" to it, when certain condition is met, in a conditional statement.
$V{slabSum}==0 ?
    ($F{percent} + " of first " + $F{slab_end}) :
            ($V{slabSum}=new Double(0.0) && ($F{percent} + " of first " + $F{slab_end})))

Any suggestions would be helpful.

Thank you
0
Comment
Question by:DOCDGA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
James0628 earned 2000 total points
ID: 40428111
I have not used Jasper, so I'm just guessing here.

 getValue() sounds like something that you'd use to read the value from a variable, not set the value.  So maybe you need to leave off ".getValue()".  Or maybe replace it with something else (like if there was a .setValue() ).

 Similarly, if the "(java.lang.Double)" in front of variable_slabSum is trying to set/cast the type for variable_slabSum to double, that wouldn't seem necessary, if variable_slabSum was declared as double, and it doesn't seem to make sense (to me).  I could see maybe setting the type for the value that's put in the variable ( Double(0.0) ), but trying to set the type on the variable itself when you put a value in that variable seems odd.

 But, like I said, I haven't used Jasper, so I'm just making some guesses/observations.

 James
0
 

Author Comment

by:DOCDGA
ID: 40428613
Hi James,

 Really appreciate your time in answering the question posted. I am a new bie too to jasper reports.
The first expression is the one interpreted by Jasper Reports software. The second expression in my previous post in the one that I have written. I have already declared the variable to be double.

Thanks
0
 
LVL 35

Expert Comment

by:James0628
ID: 40429697
Sorry, but I don't really know what else to suggest.  After some looking around, I suspect that you may need to change how you're trying to reset that variable.  Maybe something like a scriptlet, or maybe change something in the variable definition.

 FWIW, you seem to just be saying that if slabSum is not 0, then set it to 0, which seems a little odd.  It's just alternating between 0 and whatever value you're putting in it somewhere else?  If nothing else, the If seems unnecessary.  Couldn't you just always set it to 0 at that point?  If it's not 0, you make it 0; and if it's already 0, setting it to 0 won't change anything.


 If no one else joins in, you can use the "Request Attention" link to see if the mods can get some others to look at your question.  But since it's the start of the weekend, you might want to give it some more time and wait until Monday or Tuesday.

 James
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Curious about the latest ransomware attack? Check out our timeline of events surrounding the spread of this new virus along with tips on how to mitigate the damage.
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question