Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » If Statement
If Statement [message #1811317] Fri, 30 August 2019 15:45 Go to next message
Keith Stramler is currently offline Keith StramlerFriend
Messages: 9
Registered: November 2015
Junior Member
Hello. I know this should be fairly easy, but I have been trying for hours to get this to work. I am trying to get a "If then else" statement to work and I don't think I am getting the correct syntax. In Eclipse for two columns, the data is either True or False or null. I want to display an X if the data is True otherwise display a null.

My code is:

if (dataSetRow["hhsDSHSBL"] = true)
dataSetRow["hhsDSHSBL"] = "X"
else
dataSetRow["hhsDSHSBL"] = " "

Right now, one column is false and the other is True. Using this code, in correlation with the column names, both display an X.

How can I get the this code to work correctly?

I would appreciate any help...this is very frustrating, especially since this should be a simple If statement.
Re: If Statement [message #1811319 is a reply to message #1811317] Fri, 30 August 2019 17:31 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30685
Registered: July 2009
Senior Member
It's not even clear (to me) what language you are using or which Eclipse tools is involved. Likely Google would help answer your question with a tiny bit of research on your part.
Re: If Statement [message #1814144 is a reply to message #1811319] Wed, 04 September 2019 17:24 Go to previous messageGo to next message
Keith Stramler is currently offline Keith StramlerFriend
Messages: 9
Registered: November 2015
Junior Member
I apologize for waiting so long to get back to this. I had a family emergency.

I also apologize for not providing enough information. I am using Eclipse Neon.3 and java script. I have googled this looking for an answer. It is not as if I do not try to find an answer before coming to this forum for help. The basic answer I find is this:

if(x===true){
...
} else if(x===false){
....
} else {
....
}

I have tried using this syntax multiple times tweaking little things and either I can get both columns to be null or both columns to be X or nothing that I want displayed in the table returns, including all the other columns.

As I said earlier, this should be a simple thing, but not understanding java script very well, this has proven to be quite frustrating.

I would appreciate any help and if more information is needed please let me know.
Re: If Statement [message #1814149 is a reply to message #1814144] Wed, 04 September 2019 18:42 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 511
Registered: August 2014
Senior Member
The question is actually off-topic for Eclipse, as it handles the Javascript language.

I googled for 'javascript tutorial' and got over 300 million responses, the first of which were pretty good.



--

Tauno Voipio
Re: If Statement [message #1814151 is a reply to message #1814149] Wed, 04 September 2019 19:10 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3536
Registered: July 2009
Senior Member

A single '=' assigns a value instead of doing a comparison as you've intended.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators


Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Adding Column
Next Topic:SWTBOt : Extrenal RCP application got launched but crashed
Goto Forum:
  


Current Time: Sat Dec 07 22:04:13 GMT 2019

Powered by FUDForum. Page generated in 0.03094 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top