If you are unable to create a new account, please email support@bspsoftware.com

 

What is the meaning of (SelectObject[0] && SelectObject[0] != undefined)

Started by inu, 04 Sep 2014 09:55:16 AM

Previous topic - Next topic

inu

HI
(1)i created one pick list prompt, where i want to limit the selection made by user, using javascript code. It worked properly, but  i did not understand some statement of javascript , used as if(SelectObject[0] && SelectObject[0] != undefined).
First what is the meaning of undefined , second why SelectObject[0] has been taken two times.

(2)In the same prompt for same purpose one more statement , which is not able to get as
      for ( i = 0; i < SelectObject[0].options.length; i++)
      {   if (SelectObject[0].options.selected == true)

Cheers!
Inam


MFGF

Quote from: inu on 04 Sep 2014 09:55:16 AM
HI
(1)i created one pick list prompt, where i want to limit the selection made by user, using javascript code. It worked properly, but  i did not understand some statement of javascript , used as if(SelectObject[0] && SelectObject[0] != undefined).
First what is the meaning of undefined , second why SelectObject[0] has been taken two times.

(2)In the same prompt for same purpose one more statement , which is not able to get as
      for ( i = 0; i < SelectObject[0].options.length; i++)
      {   if (SelectObject[0].options.selected == true)

Cheers!
Inam

Hi Inam,

Although this is a different question, it is really the same kind of situation as this post of yours:

http://www.cognoise.com/index.php/topic,25781.0.html

In that thread you were asking about a specific piece of syntax in JavaScript without giving any detail of the requirement you're trying to solve or what you need to achieve. In that thread, we told you this:

Quote from: MFGF on 03 Sep 2014 11:40:03 AM
...asking isolated questions without any context is not the best way to get helpful replies. What is the big issue you refer to? What are you trying to achieve? What exactly is it your client needs you to provide? Using javascript isn't necessarily the right solution to everything.

You didn't reply, even though two people posted back trying to understand what you're doing so they could try to help you. Here you are again, asking the same kind of focused syntax-specific question. The advice is the same - tell us what you are trying to do, and we will help if we can. I must add, though, that your rudeness in not bothering to reply before when people offered to try to help probably means less and less people will try in future. You reap what you sow.

MF.
Meep!

navissar

On top of everything said by the muppet*, this isn't even a Cognos related question. It'll be like someone trying to embed a YouTube video in report studio using an HTML item and then asking here how the video was rendered. This is pure JavaScript. Almost nobody here is qualified enough to teach JavaScript, and it looks like you need some very basic lessons. Maybe stack overflow is a better place for such questions, though I suggest you get some training in JavaScript. If you need it to do your job, then you need to learn it properly.


*(I'm writing this from my phone. Muppet gets autocorrected to murder.)

inu

Quote from: MFGF on 04 Sep 2014 10:05:23 AM
Hi Inam,

Although this is a different question, it is really the same kind of situation as this post of yours:

http://www.cognoise.com/index.php/topic,25781.0.html

In that thread you were asking about a specific piece of syntax in JavaScript without giving any detail of the requirement you're trying to solve or what you need to achieve. In that thread, we told you this:

You didn't reply, even though two people posted back trying to understand what you're doing so they could try to help you. Here you are again, asking the same kind of focused syntax-specific question. The advice is the same - tell us what you are trying to do, and we will help if we can. I must add, though, that your rudeness in not bothering to reply before when people offered to try to help probably means less and less people will try in future. You reap what you sow.

MF.


HI MFGF,
I m creating pick list prompt , where huge no. of items are there, that's why i want to limit the selection make by the user.
To get the desired result i m using javascript function , I got the required output. but i wanted to understand the syntax used in javascript code, that's why i aksed to define the syntax meaning.
But i m happy that i got the meaning of that syntax.

I m too lucky that whatever i post into this forum, you people show your willingness to help me, and worry about it.
Thanks specially to you MFGF.
You poeple are actually the well wisher of us.


Cheers!
Inam