473,769 Members | 6,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
16 1749
PeteCresswell <x@y.z> wrote in
news:cj******** *************** *********@4ax.c om:
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.c om:
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.invali d>
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 "zstblCalcS tat" 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
3083
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
6654
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 machines which we have ms-windows 2000 installed! So now no-one machine can continue run my routines which accessed ms-dos by ASP
235
11800
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 stay with C and still be able to produce Java byte code for platform independent apps. Also, old programs (with some tweaking) could be re-compiled and ported to the JVM. We have been developing such a tool over the last 2 years and currently...
9
3499
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 with atleast one entry). I'm a little resistant to implementing a regular expression validation, because of the overhead involved (not because I can't :-). Obviously, it's possible to implement the pattern validation using regular string ops ..
5
1966
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 class"
2
3812
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 cause object to be deleted when shared/weak ptr will go out of scope. -- Wymiana starych układów... na nowe układy - prawie jak walka z korupcja. Walka z wychowaniem seksualnym i erotyką - prawie jak walka z patologią.
0
3572
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 detailsview. Table 'pc' is related to table 'lok'. I tried a lot of things, but still without succes. Here are the two methods i tried with two different errors. It works only when i introduce directly a value in "DefaultValue" (see below)
3
3289
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 "Searching..." page then, refreshes and displays the table I want. I have code that grabs data from the page using cURL but when I look at the data it contains the "Searching..." page and not the table that I want. below is the code i have so far....Thanks...
8
2071
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 the user is: "Hello world" & chr(64) & vbcrlf If I capture the textbox, I get: ""Hello world" & chr(64) & vbcrlf" But I would like get the string: "Hello world@" & vbcrlf
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10214
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10048
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.