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
521 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Suggestions of cloud services for small businesses 9 69
EDI Solution or comparable? 2 51
Need software for photo capture from TV tuner card 20 92
Supermicro 91 error 8 62
If your app took Google’s lash recently, here are the 5 most likely reasons.
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

756 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