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
461 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
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
James0628 earned 500 total points
Comment Utility
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
Comment Utility
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 34

Expert Comment

by:James0628
Comment Utility
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
If your app took Google’s lash recently, here are the 5 most likely reasons.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now