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
507 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
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 34

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dropbox 3 88
How  do I get an older program to run in Windows 10? 20 114
Chrome: How to show the Bookmarks bar? 4 46
Event log and black screen 22 58
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

856 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