Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

When is a number not a number?

4 posts in PowerSite specific Last posting was on 2001-11-29 22:37:50.0Z
Alan Rosine Posted on 2001-08-10 00:44:40.0Z
Newsgroups: sybase.public.powersite
From: "Alan Rosine" <alan.rosine@dfas.mil>
Subject: When is a number not a number?
Date: Thu, 9 Aug 2001 19:44:40 -0500
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2462.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000
NNTP-Posting-Host: DNS21z.DFAS.MIL 207.133.68.234
Message-ID: <382_TJj5NkTIBHA.242@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powersite:111
Article PK: 862553

I've got some server script that determines the "SELECTED" entry in a SELECT
control. (The code below is a snippet.) If no information is returned then
I want the number defaulted a hard-coded value, otherwise, I want number
that matches the returned value selected. The defaulted, hard-coded value
works but the comparison (i == val) doesn't work if a a value was returned
in the information. I've verified that it is indeed a number within the
range I want.

Why would this comparison fail like this?

TIA
Alan Rosine

<snip>
if (docInfo.advPayMonths == null) || (docInfo.advPayMonths == undefined) ||
isNaN(docInfo.advPayMonths) {
val = 6;
} else {
val = docInfo.advPayMonths;
}

for (i = 1; i <= 12; i++) {
document.write('<OPTION VALUE=' + i);
if (i == val) {
document.write(' SELECTED');
}
document.write('>' + i + '-' + val);
}
<snip>


Adam Simmonds [TeamSybase] Posted on 2001-08-10 03:55:09.0Z
Newsgroups: sybase.public.powersite
Date: Fri, 10 Aug 2001 13:55:09 +1000
From: "Adam Simmonds [TeamSybase]" <asimmond@mail.usyd.edu.au>
Reply-To: adam.simmonds@teamsybase.com
Organization: University Of Sydney
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: When is a number not a number?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 31
NNTP-Posting-Host: nat-457.mp.usyd.edu.au 129.78.5.201
Message-ID: <382_3B735B1D.3B823FEF@mail.usyd.edu.au>
References: <382_TJj5NkTIBHA.242@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powersite:110
Article PK: 840486

Try using the eval() JS method
A.

Alan Rosine wrote:
>
> I've got some server script that determines the "SELECTED" entry in a SELECT
> control. (The code below is a snippet.) If no information is returned then
> I want the number defaulted a hard-coded value, otherwise, I want number
> that matches the returned value selected. The defaulted, hard-coded value
> works but the comparison (i == val) doesn't work if a a value was returned
> in the information. I've verified that it is indeed a number within the
> range I want.
>
> Why would this comparison fail like this?
>
> TIA
> Alan Rosine
>
> <snip>
> if (docInfo.advPayMonths == null) || (docInfo.advPayMonths == undefined) ||
> isNaN(docInfo.advPayMonths) {
> val = 6;
> } else {
> val = docInfo.advPayMonths;
> }
>
> for (i = 1; i <= 12; i++) {
> document.write('<OPTION VALUE=' + i);
> if (i == val) {
> document.write(' SELECTED');
> }
> document.write('>' + i + '-' + val);
> }
> <snip>

--
__________________________

Adam Simmonds [TeamSybase]
System Architect
ITS FLEXSIS PROJECT
The University of Sydney
Phone: +61 2 9351 5174
Mobile: +61 403 341 474
Fax: +61 2 9351 7711


Alan Rosine Posted on 2001-08-10 15:43:56.0Z
Newsgroups: sybase.public.powersite
From: "Alan Rosine" <alan.rosine@dfas.mil>
Subject: Re: When is a number not a number?
Date: Fri, 10 Aug 2001 10:43:56 -0500
Lines: 64
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2462.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000
NNTP-Posting-Host: DNS21z.DFAS.MIL 207.133.68.234
Message-ID: <382_1IBPsabIBHA.65@forums.sybase.com>
References: <382_TJj5NkTIBHA.242@forums.sybase.com> <382_3B735B1D.3B823FEF@mail.usyd.edu.au>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powersite:109
Article PK: 862552

Am I not understanding? It seems that the eval() method executes a piece of
code. I'm trying to perform a comparison. The example does show it well
but the if statement is a comparison ( if (i = = val) ) and not an
assignment. I did try using the eval() method but no joy.

Any other suggestions?

TIA
Alan Rosine

"Adam Simmonds [TeamSybase]" <asimmond@mail.usyd.edu.au> wrote in message
news:3B735B1D.3B823FEF@mail.usyd.edu.au...
> Try using the eval() JS method
> A.
>
> Alan Rosine wrote:
> >
> > I've got some server script that determines the "SELECTED" entry in a
SELECT
> > control. (The code below is a snippet.) If no information is returned
then
> > I want the number defaulted a hard-coded value, otherwise, I want number
> > that matches the returned value selected. The defaulted, hard-coded
value
> > works but the comparison (i == val) doesn't work if a a value was
returned
> > in the information. I've verified that it is indeed a number within the
> > range I want.
> >
> > Why would this comparison fail like this?
> >
> > TIA
> > Alan Rosine
> >
> > <snip>
> > if (docInfo.advPayMonths == null) || (docInfo.advPayMonths == undefined)
||
> > isNaN(docInfo.advPayMonths) {
> > val = 6;
> > } else {
> > val = docInfo.advPayMonths;
> > }
> >
> > for (i = 1; i <= 12; i++) {
> > document.write('<OPTION VALUE=' + i);
> > if (i == val) {
> > document.write(' SELECTED');
> > }
> > document.write('>' + i + '-' + val);
> > }
> > <snip>
>
> --
> __________________________
>
> Adam Simmonds [TeamSybase]
> System Architect
> ITS FLEXSIS PROJECT
> The University of Sydney
> Phone: +61 2 9351 5174
> Mobile: +61 403 341 474
> Fax: +61 2 9351 7711


Giannino_Alvarez Posted on 2001-11-29 22:37:50.0Z
Newsgroups: sybase.public.powersite
From: Giannino_Alvarez
Date: Thu, 29 Nov 2001 17:37:50 -0500
Subject: Re: When is a number not a number?
Lines: 23
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Message-ID: <382_2DF345E98383103E007C506785256B13.0037631385256AC5@webforums>
References: <382_TJj5NkTIBHA.242@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub sybase.public.powersite:96
Article PK: 862544

Hi there.

I think you should try using parseInt() function.

It looks like the i == val comparation is not working because val =
docInfo.advPayMonths is not read as a number, but as a string. parseInt
converts the string to an integer.

Try this:

val = parseInt(docInfo.advPayMonths);

Also, you can find some info here:
http://developer.netscape.com/docs/manuals/communicator/jsref/index.htm

(click the index on the left, then use the "find" function of your browser
to find "parseInt"). Please tell me if this works.

---
Giannino Alvarez
giannino_alvarez@mx.sony.com
México City