Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
37%
Installation Wizard into new VRC
39%
Manual into existing VRC
3%
Manual into new VRC
21%
Total votes: 38

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 2nd January 2009, 10:49
assassinator's Avatar
assassinator assassinator is offline
Member
 
Join Date: Oct 2005
Posts: 84
assassinator is on a distinguished road
Baan: Baan IV - DB: Oracle - OS: win XP
How to compare one double field's value with zero
Baan: Other/Unknown
C/S: None/Unknown

How to compare one double field's value with zero?
The program is:
Code:
select  tdinv001.item, tdinv001.stoc
from    tdinv001
where   tdinv001._index2 inrange {:input.item.f} and {:input.item.t}
and     tdinv001.stoc > 0.0000
...
selectdo
...
endselect

The domain of tdinv001.stoc is tcqiv1, double.
But I still would get the records which tdinv001.stoc = 0. So unimaginable was, I changed tdinv001.stoc > 0.0000 to tdinv001.stoc > 1.0000. The zero records had appeared as before. It made me mad!! What is going on!

This problem would exit in all like *.stoc, for example, tdinv700.stoc.

Last edited by assassinator : 2nd January 2009 at 10:57. Reason: adding baan code tags and removing the shouting
Reply With Quote
  #2  
Old 2nd January 2009, 11:59
george7a's Avatar
george7a george7a is offline
Guru
 
Join Date: May 2004
Location: Nazareth
Posts: 1,490
george7a is on a distinguished road
Baan: IVc, 5.0 b, 5.0 c, LN 6.1 - DB: MS SQL, Oracle - OS: Windows 2000, 2003 & UNIX
Hi,

Is this the full SQL code or is there still any other code in the where clause? I have just tried your code and it worked with me.

- George
__________________
_
George Abdo
NAZDAQ - Your Documents, Your Way.
Reply With Quote
  #3  
Old 2nd January 2009, 12:16
assassinator's Avatar
assassinator assassinator is offline
Member
 
Join Date: Oct 2005
Posts: 84
assassinator is on a distinguished road
Baan: Baan IV - DB: Oracle - OS: win XP
Quote:
Originally Posted by george7a View Post
Hi,

Is this the full SQL code or is there still any other code in the where clause? I have just tried your code and it worked with me.

- George

Yes, as followed is all.
Code:
select  tdinv001.item, tdinv001.cwar, tdinv001.stoc
from    tdinv001
where   tdinv001._index2 inrange {:input.item.f} and {:input.item.t}
and     tdinv001.stoc > 0.0000
and     tdinv001.cwar > :old.cwar
selectdo
    old.cwar = tdinv001.cwar
selectempty
    old.cwar = ""
endselect
I found it would work in some records, the others would not(I just say for one same item).

Last edited by assassinator : 2nd January 2009 at 12:18. Reason: adding baan code tags and disabling smiles.
Reply With Quote
  #4  
Old 2nd January 2009, 12:27
george7a's Avatar
george7a george7a is offline
Guru
 
Join Date: May 2004
Location: Nazareth
Posts: 1,490
george7a is on a distinguished road
Baan: IVc, 5.0 b, 5.0 c, LN 6.1 - DB: MS SQL, Oracle - OS: Windows 2000, 2003 & UNIX
Let me see if I got you right. This code does not work just for one item? All other items with tdinv001.stoc =0 are not being shown, right?

How are you checking the result of the SQL? Are you making a report?
__________________
_
George Abdo
NAZDAQ - Your Documents, Your Way.
Reply With Quote
  #5  
Old 2nd January 2009, 12:28
_Ralph_'s Avatar
_Ralph_ _Ralph_ is offline
Senior Member
 
Join Date: Oct 2006
Location: Brazil
Posts: 209
_Ralph_ is on a distinguished road
Baan: LN 6.1 - DB: DB2 - OS: Unix
The value of a double field directly on the data base sometimes is different of the one find in Baan,

We faced this problem here with record on tfgld106.

On the reports sometimes a -0 appears.

Doing a query on the database we found numbers like -0.000000000001254.

We solve that using double.cmp on the selectdo statment. but i do not know if in your case it will do what u need.
Reply With Quote
  #6  
Old 4th January 2009, 01:03
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,935
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
We also ran into the same issue. As a matter of fact it worked on our test server, but not on production. We also used double.cmp in the select statement.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #7  
Old 5th January 2009, 03:17
assassinator's Avatar
assassinator assassinator is offline
Member
 
Join Date: Oct 2005
Posts: 84
assassinator is on a distinguished road
Baan: Baan IV - DB: Oracle - OS: win XP
Thanks for all your attention.
George7a, you had some misunderstand cause by my indefinite description. I means was it had many situations liked that but I tested one item. Thank you.
Thanks for Ralph. I used tdinv001.stoc > 0.000000000001254 would effectively. But while I tested to the zero records, it should must like tdinv001.stoc > 0.0. Not for the 0.000000000001254 . So strange!
Thanks for mark_h's reply. I didnot know why, but it is the true that use > 0.0 sometimes would effective, and sometimes not.
Reply With Quote
  #8  
Old 5th January 2009, 13:30
_Ralph_'s Avatar
_Ralph_ _Ralph_ is offline
Senior Member
 
Join Date: Oct 2006
Location: Brazil
Posts: 209
_Ralph_ is on a distinguished road
Baan: LN 6.1 - DB: DB2 - OS: Unix
Quote:
Originally Posted by assassinator View Post
Thanks for all your attention.
George7a, you had some misunderstand cause by my indefinite description. I means was it had many situations liked that but I tested one item. Thank you.
Thanks for Ralph. I used tdinv001.stoc > 0.000000000001254 would effectively. But while I tested to the zero records, it should must like tdinv001.stoc > 0.0. Not for the 0.000000000001254 . So strange!
Thanks for mark_h's reply. I didnot know why, but it is the true that use > 0.0 sometimes would effective, and sometimes not.
0.000000000001254 is just an example. Can be any number(with any digits).
As me and Mark said. double.cmp can solve your problem
Reply With Quote
  #9  
Old 6th January 2009, 03:19
assassinator's Avatar
assassinator assassinator is offline
Member
 
Join Date: Oct 2005
Posts: 84
assassinator is on a distinguished road
Baan: Baan IV - DB: Oracle - OS: win XP
Thanks for your remind. The function double.cmp() can solve it. But it can be used in SELECT clause.
If the compare value not in the SELECT clause, I also can use the followed script to achieve.
Code:
if tdinv001.stoc > 0.0000 then
...
endif

Last edited by assassinator : 6th January 2009 at 03:40.
Reply With Quote
Sponsored Links
  #10  
Old 6th January 2009, 15:52
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,935
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Quote:
Originally Posted by assassinator View Post
Thanks for your remind. The function double.cmp() can solve it. But it can be used in SELECT clause.
If the compare value not in the SELECT clause, I also can use the followed script to achieve.
Code:
if tdinv001.stoc > 0.0000 then
...
endif
That was a bad typing on my part - I have not used it in the select clause, but inside the selectdo.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #11  
Old 7th January 2009, 03:26
assassinator's Avatar
assassinator assassinator is offline
Member
 
Join Date: Oct 2005
Posts: 84
assassinator is on a distinguished road
Baan: Baan IV - DB: Oracle - OS: win XP
Quote:
Originally Posted by mark_h View Post
That was a bad typing on my part - I have not used it in the select clause, but inside the selectdo.
Yes, ues IF clause in selectdo is one way. How bad it is.
If it can't not be used in SELECT clause, SQL Performance has a bad efficiency.

Last edited by assassinator : 7th January 2009 at 03:32.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Undocumented Functions & Variables george7a Tools Development 81 30th September 2015 12:35
good/bad idea: keep new table fields out of derived VRC? RieseUSA Tools Development 7 30th July 2008 19:25
Fields on Form LittleJohn Tools Development 4 13th May 2004 18:00
Exchange - Only need to import date for a couple of table fields pjohns Tools Development 7 27th June 2003 10:06


All times are GMT +2. The time now is 07:28.


©2001-2017 - Baanboard.com - Baanforums.com