473,383 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Best way to store calc result that can be "NA"?

I was happily coding along, putting some calculation results (rolling
annualized rates of return - too compute-intensive to calculate
on-the-fly - had tb staged beforehand via a batch job) into Double
fields.

Now, the clients have just dropped a litle bomb: they want to see
"(NA)" if the calculation failed due to insufficient input data.

That means our fields can have three kinds of values:

- Null: (something to say we've never even tried to make the calc)

- Decimal: (let's say -99.00 to +99.99 - including zero)

- CalcDidNotWork: Something that says we tried the calc and there was
not enough data
My kneejerk is to change these to text fields, but I wonder if greater
minds than mine have come up with a better approach.

?
Nov 13 '05 #1
16 1710
On Tue, 22 Feb 2005 15:38:55 -0500, PeteCresswell <x@y.z> wrote:
staged beforehand via a batch job

I should add that right now it looks like these fields are the final
result tb used on various reports. i.e. they do not have to be
summed....(crossed fingers....)
Nov 13 '05 #2
And, while I'm at it...

Is there any downside to storing amounts as percentages instead of
storing them as decimals and changing to percent for display.

I've always stored as decimal numbers and comverted...but somebody
thinks it would be better to store as percent.....
Nov 13 '05 #3
PeteCresswell wrote:
I was happily coding along, putting some calculation results (rolling
annualized rates of return - too compute-intensive to calculate
on-the-fly - had tb staged beforehand via a batch job) into Double
fields. My kneejerk is to change these to text fields, but I wonder if greater
minds than mine have come up with a better approach.


I am definitely not a greater mind than yours with respect to Access,
but what about...

A null would be a result of the bad calculation you mentioned. I assume
you're working in Jet, which allows you to update a double to a null.

Null means no value, which is in keeping with an error or insufficient
data and could act as a flag for bad calcs and still be in keeping (I
think, better not post this on comp.databases.theory!!!!) with the
relational way of doing things (ie, not storing nulls as data).
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #4
Why don't you add a 2nd field to show status of the calculated field? That
way you can note among other things that the calculated value is now invalid
because the input values have changed.

"PeteCresswell" <x@y.z> wrote in message
news:fq********************************@4ax.com...
I was happily coding along, putting some calculation results (rolling
annualized rates of return - too compute-intensive to calculate
on-the-fly - had tb staged beforehand via a batch job) into Double
fields.

Now, the clients have just dropped a litle bomb: they want to see
"(NA)" if the calculation failed due to insufficient input data.

That means our fields can have three kinds of values:

- Null: (something to say we've never even tried to make the calc)

- Decimal: (let's say -99.00 to +99.99 - including zero)

- CalcDidNotWork: Something that says we tried the calc and there was
not enough data
My kneejerk is to change these to text fields, but I wonder if greater
minds than mine have come up with a better approach.

?

Nov 13 '05 #5
On Tue, 22 Feb 2005 17:24:27 -0330, Tim Marshall
<TI****@PurplePandaChasers.Moertherium> wrote:
A null would be a result of the bad calculation you mentioned. I assume
you're working in Jet, which allows you to update a double to a null.

Null means no value, which is in keeping with an error or insufficient
data and could act as a flag for bad calcs and still be in keeping (I
think, better not post this on comp.databases.theory!


But I have two "Null" situations:

- Calc couldn't do the job
- We've never even tried.

But the text thing is really bothering me..... maybe Ron's idea about
flag fields to explain the reason for Null.....and a *lot* of IIF
statements throughout the app...

What I'm really trolling for here is somebody that's actually been
this route.... Lacking that, I'd have to say my heart is with you and
Ron.
Nov 13 '05 #6
One more (unrelated) thing:

Is it just me, or are there "Re" literals proliferating in my replies?

My current subject line looks like:

"Re: Re: Re: Best way to store calc result that can be "NA"?"

Some setting in my newsreader (Agent)?
Nov 13 '05 #7
If you have a defined range for the values that are "acceptable" for that
field (say -9999 to +9999), you could use a value that is way out of range
(-99999999) and then do a test for a value that is less than -99999990 and
use that to say that the Calc couldn't do the job.

Otherwise, using a flag field would be a reasonable solution.

--

Ken Snell
<MS ACCESS MVP>

"PeteCresswell" <x@y.z.Invalid> wrote in message
news:lt********************************@4ax.com...
On Tue, 22 Feb 2005 17:24:27 -0330, Tim Marshall
<TI****@PurplePandaChasers.Moertherium> wrote:
A null would be a result of the bad calculation you mentioned. I assume
you're working in Jet, which allows you to update a double to a null.

Null means no value, which is in keeping with an error or insufficient
data and could act as a flag for bad calcs and still be in keeping (I
think, better not post this on comp.databases.theory!


But I have two "Null" situations:

- Calc couldn't do the job
- We've never even tried.

But the text thing is really bothering me..... maybe Ron's idea about
flag fields to explain the reason for Null.....and a *lot* of IIF
statements throughout the app...

What I'm really trolling for here is somebody that's actually been
this route.... Lacking that, I'd have to say my heart is with you and
Ron.

Nov 13 '05 #8
PeteCresswell wrote:
On Tue, 22 Feb 2005 17:24:27 -0330, Tim Marshall
<TI****@PurplePandaChasers.Moertherium> wrote:
A null would be a result of the bad calculation you mentioned. I assumeyou're working in Jet, which allows you to update a double to a null.
Null means no value, which is in keeping with an error or insufficientdata and could act as a flag for bad calcs and still be in keeping (Ithink, better not post this on comp.databases.theory!


But I have two "Null" situations:

- Calc couldn't do the job
- We've never even tried.

But the text thing is really bothering me..... maybe Ron's idea about
flag fields to explain the reason for Null.....and a *lot* of IIF
statements throughout the app...

What I'm really trolling for here is somebody that's actually been
this route.... Lacking that, I'd have to say my heart is with you and
Ron.


I haven't been this route before. Plus, I'm not a greater Access mind.
How about leaving the field as Decimal and using, say, -10000 for
recalcitrant situations? Then convert -10000 to "(NA)" at the output
stage maybe with a function that returns CStr(Nz([CalcField],"")) or
"(NA)". Use "WHERE [CalcField] <> -10000" if the values need to be
summed?

James A. Fortune

Nov 13 '05 #9
PeteCresswell wrote:
I was happily coding along, putting some calculation results (rolling
annualized rates of return - too compute-intensive to calculate
on-the-fly - had tb staged beforehand via a batch job) into Double
fields.

Now, the clients have just dropped a litle bomb: they want to see
"(NA)" if the calculation failed due to insufficient input data.

That means our fields can have three kinds of values:

- Null: (something to say we've never even tried to make the calc)

- Decimal: (let's say -99.00 to +99.99 - including zero)

- CalcDidNotWork: Something that says we tried the calc and there was
not enough data
My kneejerk is to change these to text fields, but I wonder if greater
minds than mine have come up with a better approach.


You could use

Public Function Indeterminate() As Double
On Error Resume Next
Indeterminate = 1E+308
Indeterminate = Indeterminate + 1E+308
Indeterminate = Indeterminate * 0
End Function

to return a number that should display as

-1.#IND

(This function should be credited primarily to Vincent Quesnoit.)

--
--
Lyle
--
From ADO28.chm

Deprecated Components
Each of the following components is considered obsolete. While these
components are still supported in this release of the Microsoft® Data
Access Components (MDAC), they may be removed in the future. When
writing new applications, you should avoid using these deprecated
components. When modifying existing applications, you are strongly
encouraged to remove any dependency on these components.

ODBC Provider (MSDASQL)
You are strongly encouraged to use one of the native OLE DB Providers
instead of the Microsoft Open Database Connectivity (ODBC) Provider.
Native OLE DB Providers provide better application stability and
performance. Furthermore, native OLE DB Providers will be supported in
the future, whereas MSDASQL will not have any new features added to it,
will not be available on 64-bit, and will not be accessible from the OLE
DB NET Data Provider.

Remote Data Services (RDS)
Remote Data Services (RDS) is a proprietary Microsoft mechanism for
accessing remote data across the Internet or intranet. Microsoft is now
shipping the Microsoft Simple Object Access Protocol (SOAP) Toolkit 2.0
that enables you to access remote data using an open, XML-based
standard. Given the availability of the SOAP Toolkit 2.0, you should
migrate from RDS to SOAP. The SOAP 2.0 Toolkit 2.0 also includes sample
code for remotely accessing Microsoft ActiveX® Data Objects (ADO)
Recordsets.

Jet and Replication Objects (JRO)
The Microsoft Jet OLE DB Provider and other related components were
removed from MDAC 2.6. Microsoft has deprecated the Microsoft Jet
Engine, and plans no new releases or service packs for this component.
As a result, the Jet and Replication Objects (JRO) is being deprecated
in this release and will not be available in any future MDAC releases.

.....
Nov 13 '05 #10
PeteCresswell <x@y.z> wrote in
news:cj********************************@4ax.com:
And, while I'm at it...

Is there any downside to storing amounts as percentages
instead of storing them as decimals and changing to percent
for display.

I've always stored as decimal numbers and comverted...but
somebody thinks it would be better to store as percent.....


And someone surely thinks the world is flat.
Since a percentage is by definition the ratio of two numbers, the
"correct" way is to never store the ratio but calculate it when
needed, based on the rationale that somebody will forget to
change the result after changin one of the two numbers.

Now I realize you said that you are precalculating some values,
so that may mitigate the lack of correctness, but I would
hesitate to go further than what is actually necessary in the
pre-calculation, therefore I would convert from a fraction to a
percent at display time, never before.

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #11
PeteCresswell <x@y.z> wrote in
news:fq********************************@4ax.com:
I was happily coding along, putting some calculation results
(rolling annualized rates of return - too compute-intensive to
calculate on-the-fly - had tb staged beforehand via a batch
job) into Double fields.

Now, the clients have just dropped a litle bomb: they want to
see "(NA)" if the calculation failed due to insufficient input
data.

That means our fields can have three kinds of values:

- Null: (something to say we've never even tried to make the
calc)

- Decimal: (let's say -99.00 to +99.99 - including zero)

- CalcDidNotWork: Something that says we tried the calc and
there was not enough data
My kneejerk is to change these to text fields, but I wonder if
greater minds than mine have come up with a better approach.

?


I handle this sort of situation by including a second field that
returns the value type (calculation status), say an integer type
with 1,2,3 for your 3 kinds.

At display time, use a case structure or nested iif() functions
to display what is needed.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #12
Per Bob Quintal:
but I would
hesitate to go further than what is actually necessary in the
pre-calculation, therefore I would convert from a fraction to a
percent at display time, never before.


That's always been my gut-level feeling - but I never had the words to back it
up...
--
PeteCresswell
Nov 13 '05 #13
Per Bob Quintal:
I handle this sort of situation by including a second field that
returns the value type (calculation status), say an integer type
with 1,2,3 for your 3 kinds.

At display time, use a case structure or nested iif() functions
to display what is needed.


I think that's where I'm going.

Using wildly out-of-range values called out to me for a short time...but it
seems like I'd be exposing myself to unforseen situations like SUM() and
whatever other calculations might be made - which already nailed me on the input
side before it dawned on me that Lipper indicates a Null return value with
-99.99 and PSN indicates same with a -999.

--
PeteCresswell
Nov 13 '05 #14
On Tue, 22 Feb 2005 19:29:56 -0500, "(Pete Cresswell)" <x@y.z.invalid>
wrote:
I handle this sort of situation by including a second field that
returns the value type (calculation status), say an integer type
with 1,2,3 for your 3 kinds.


Just as a point of interest; I thought "Well, this is an
under-the-covers sort of thing, so why not just use a text field and
populate it with a literal value describing the situation...no table
to link to, no translation when somebody wants to see what's
happening..

Turns out that Text fields are a lot more expensive than Longs.... The
DB size lept from 44 megs to a half-gig....

So I'm back to doing exactly what you suggest - with a little system
table "zstblCalcStat" to document the values, but no RI on the values.
Nov 13 '05 #15
Bri
Pete,

It gets even stranger. I'm using Mozilla 1.4.1 and in the Thread Pane
there is only one Re:, but in the Message Pane it shows the three ("Re:
Re: Re: Best...). OK, now I notice that the Subject in this Reply also
only has the one Re: in it. One least thing to check... Yup, the message
source of your message shows the three of them. In my case I would say
that Mozilla figures out that there are redundant ones and filters them
out when viewing the subject (except the Message Pane and the Source).

--
Bri

PeteCresswell wrote:
One more (unrelated) thing:

Is it just me, or are there "Re" literals proliferating in my replies?

My current subject line looks like:

"Re: Re: Re: Best way to store calc result that can be "NA"?"

Some setting in my newsreader (Agent)?


Nov 13 '05 #16
Per Bri:
In my case I would say
that Mozilla figures out that there are redundant ones and filters them
out when viewing the subject (except the Message Pane and the Source).


It's got tb something with my Agent setup bc the copy I run at home does not do
that - yet the copy I run at a client site does.
--
PeteCresswell
Nov 13 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Berthold Hoellmann | last post by:
Hello, When I use ./configure --with-thread --with-fpectl --with-signal-module \ --with-pymalloc --enable-shared --with-cxx=g++ make test on 2.3.3 I get
14
by: Vilmar Brazão de Oliveira | last post by:
Hi all, I was using: <% Set objWshell = Server.CreateObject("WScript.Shell") objWshell.Run "%COMSPEC% /C ren topoX.jpg topo_cliente.jpg", 0, TRUE %> BUT the comand COMSPEC disapeared of all my...
235
by: napi | last post by:
I think you would agree with me that a C compiler that directly produces Java Byte Code to be run on any JVM is something that is missing to software programmers so far. With such a tool one could...
9
by: Anders Borum | last post by:
Hello! I have a class that needs to validate the input value, when a programmer changes a specific property on a class. The input should only accept the following pattern {1,n} (alpha-numeric...
5
by: Rob | last post by:
In many articles related to VB.net the word "class" is used... How many meanings are there to this word ? "possible to derived a class from another" "forms are full-fledged classes" "base...
2
by: Rafał Maj Raf256 | last post by:
How can I manually (other then http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html) create a shared, and a weak pointer to "this"? Of course I dont want the shared / weak pointer to...
0
by: André | last post by:
Hi, Still the same (unsolved problem), but other error now. I have a detailsview for inserting data, and a dropdownlist which selectedValue must be used to fill one of the field of the...
3
by: Aaron | last post by:
I'm trying to parse a table on a webpage to pull down some data I need. The page is based off of information entered into a form. when you submit the data from the form it displays a...
8
by: Freddy Coal | last post by:
Hi, I would like make a search and replace in a file, for that I need get the text in a textbox, but I need recognyze literally characters of the user like a commands, for example: The chain of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.