logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
rbello  
#1 Posted : Monday, May 20, 2013 9:52:24 PM(UTC)
rbello

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/21/2013(UTC)
Posts: 2

Dear,
Is it possible to change the formula below to the "N/A" turn 0?
If(IsDefined(Security("XPTO",C)),Security("XPTO",C),0);

Follows the result of exploration:
06/03/2005 - 50.0000 - 40.3745 - 250.9324 - 54.9330 - N/A
06/10/2005 - 50.0000 - 42.9787 - 226.2136 - 55.9521 - N/A
06/17/2005 - 49.0000 - 56.4882 - 244.9415 - 60.8479 - N/A
06/24/2005 - 48.0000 - 51.7445 - 202.9678 - 58.7507 - N/A
07/01/2005 - 47.0000 - 57.4359 - 207.0000 - 61.3475 - 6.9645
07/08/2005 - 46.0000 - 56.5217 - 174.8092 - 59.9487 - 6.9645
07/15/2005 - 45.0000 - 57.3467 - 156.3577 - 58.9545 - 7.2359
07/22/2005 - 44.0000 - 68.5743 - 152.8614 - 58.9506 - 7.5977
07/29/2005 - 43.0000 - 58.7563 - 154.5714 - 59.3492 - 8.3194


mstt  
#2 Posted : Tuesday, May 21, 2013 1:47:30 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi rbello

The IsDefined() and IsUndefined() functions are not as useful as they might appear to be due to (what I consider to be) poor implementation. The problem with them is that they have to surround the code causing the N/A. Sadly they can't output values other than TRUE or FALSE. Placing these functions inside an If() function just perpetuates the N/A problem.

There is one DLL add-on function that does the job properly - unfortunately it's only available with one of the add-ons. However there is a simple solution to remove N/A from any data array, and that is to pass it through any one of several Forum.DLL functions. I almost always use ExtFml("Forum.Sum",Data Array,1) to convert all N/As in a data array to zeros. After the correction there are ways to convert leading zeros to a more appropriate value if that's desirable or necessary, but just converting all leading N/As to zeros is all that's usually necessary.

Your line of code ...
If(IsDefined(Security("XPTO",C)),Security("XPTO",C),0);
would become ...
ExtFml("Forum.Sum",Security("XPTO",C),1);

Roy

rbello  
#3 Posted : Tuesday, May 21, 2013 8:39:34 PM(UTC)
rbello

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/21/2013(UTC)
Posts: 2

Hi Roy, thanks a lot
Worked properly was what I wanted!
Hugs.
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.