|
Home > Archive > Getting Started with dBASE > November 2006 > Deleting a Null Value
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Deleting a Null Value
|
|
|
| The application that I'm supporting contains a large number of numeric fields, such as temperature and wind speed, where zero is a valid value and is quite different from NULL. Sometimes a data entry person enters a number in the wrong field on a form and
needs to delete the entry. However, any attempt to delete a number results in dBASE setting it to zero.
Can anyone tell me the best way to allow users to set a field back to NULL? I'm sure this is a pretty common problem, but I haven't been able to locate an answer on the boards or in the documentation. I am new to dBASE. I did buy and read Ken Mayer's book
. Ken discusses the NULL issue, but I can't find a passage that addresses numeric zero/NULL values. Possibly I just missed it. It is a big book.
Thanks for any assistance.
Clay
| |
| John Marshall 2006-11-09, 7:14 pm |
|
Clay:
You'll need to do it in code: Temperature = null for that record. This might be most easily accomplished using a pushbutton for each field on a form with grid or other means of locating and selecting records.
JM
Clay Wrote:
> The application that I'm supporting contains a large number of numeric fields, such as temperature and wind speed, where zero is a valid value and is quite different from NULL. Sometimes a data entry person enters a number in the wrong field on a form a
nd needs to delete the entry. However, any attempt to delete a number results in dBASE setting it to zero.
>
> Can anyone tell me the best way to allow users to set a field back to NULL? I'm sure this is a pretty common problem, but I haven't been able to locate an answer on the boards or in the documentation. I am new to dBASE. I did buy and read Ken Mayer's bo
ok. Ken discusses the NULL issue, but I can't find a passage that addresses numeric zero/NULL values. Possibly I just missed it. It is a big book.
>
> Thanks for any assistance.
> Clay
| |
| Ken Mayer [dBVIPS] 2006-11-09, 7:14 pm |
| John Marshall wrote:
> Clay:
>
> You'll need to do it in code: Temperature = null for that record. This might be most easily accomplished using a pushbutton for each field on a form with grid or other means of locating and selecting records.
To take it a step further, I'd ask the user if they wanted to null the
field or not. If they select "yes", then replace the value with NULL
otherwise with zero ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
|
| Ah, I was afraid that would be the answer. It's far more work than I had hoped for, but I appreciate the response.
I'm in the process of upgrading from dB2K to dBASE PLUS 2.61.1 and, annoyingly, tabbing through a numeric field that contains decimals now displays a zero. Although it doesn't actually place a zero in the field, pressing delete to try to remove the zero d
oes convert the field to zero. So, ".0" = NULL, but "0.0" = 0. Rather confusing to a user (and to me).
What I'd really like to do is trap the pressing of the delete key in a field, and if all the digits are selected, set the value to NULL. And, I'd like to insure that nothing is ever displayed in the field if the value is already NULL.
This seems more difficult than it should be, but maybe it'll become clearer to me when I get further into learning dBASE.
Thanks, Clay
Ken Mayer [dBVIPS] Wrote:
> John Marshall wrote:
>
> To take it a step further, I'd ask the user if they wanted to null the
> field or not. If they select "yes", then replace the value with NULL
> otherwise with zero ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| John Marshall 2006-11-10, 7:15 pm |
| Clay:
I went through your same situation a year ago ... I'm presuming that your operator is editing data directly in a grid? If that is the case, I'd recommend the following ...
1. set the grid so that the user cannot edit directly in it, but rather, use it for visual reference and navigation.
2. set up a set of entryfields above or below the grid that match the fields in the grid that you wish to have available to enter data.
3. Set up an "on_Selection_change" event for the grid which populates each entryfield with the data of the selected grid row.
4. Create an "add" and "edit" button whose "on_click" events set the rowset into edit (beginEdit) or add (beginAppend) modes and enable the entryfields.
5. Create an "Save" button whose "on_click" event verifies the data before saving.
6. Create a "cancel" button which will disable the entryfields and cancel (abandon) any changes.
This effectively allow you to "trap" user related issues before they are saved.
Finally, take a look at the following page, especially the "Getting Started" by Ted Blue. I found it immensely helpful in envisioning solutions with real examples. It's a really quick read and can provide you with gratuitous solutions!
http://econ2.potsdam.edu/dLearn/
JM
Clay Wrote:
> Ah, I was afraid that would be the answer. It's far more work than I had hoped for, but I appreciate the response.
>
> I'm in the process of upgrading from dB2K to dBASE PLUS 2.61.1 and, annoyingly, tabbing through a numeric field that contains decimals now displays a zero. Although it doesn't actually place a zero in the field, pressing delete to try to remove the zero
does convert the field to zero. So, ".0" = NULL, but "0.0" = 0. Rather confusing to a user (and to me).
>
> What I'd really like to do is trap the pressing of the delete key in a field, and if all the digits are selected, set the value to NULL. And, I'd like to insure that nothing is ever displayed in the field if the value is already NULL.
>
> This seems more difficult than it should be, but maybe it'll become clearer to me when I get further into learning dBASE.
>
> Thanks, Clay
>
> Ken Mayer [dBVIPS] Wrote:
>
>
| |
|
| John,
I really appreciate your suggestion. It gives me a great place to start. And thanks for the link to the dBASE Online Learning page. It looks like a great site, and it's one that I have not seen before. I'll definitely look over the Getting Started section
. Hopefully it will help me get over what I'm finding is a very steep learning curve.
Thanks, Clay
John Marshall Wrote:
> Clay:
>
> I went through your same situation a year ago ... I'm presuming that your operator is editing data directly in a grid? If that is the case, I'd recommend the following ...
>
> 1. set the grid so that the user cannot edit directly in it, but rather, use it for visual reference and navigation.
>
> 2. set up a set of entryfields above or below the grid that match the fields in the grid that you wish to have available to enter data.
>
> 3. Set up an "on_Selection_change" event for the grid which populates each entryfield with the data of the selected grid row.
>
> 4. Create an "add" and "edit" button whose "on_click" events set the rowset into edit (beginEdit) or add (beginAppend) modes and enable the entryfields.
>
> 5. Create an "Save" button whose "on_click" event verifies the data before saving.
>
> 6. Create a "cancel" button which will disable the entryfields and cancel (abandon) any changes.
>
> This effectively allow you to "trap" user related issues before they are saved.
>
>
> Finally, take a look at the following page, especially the "Getting Started" by Ted Blue. I found it immensely helpful in envisioning solutions with real examples. It's a really quick read and can provide you with gratuitous solutions!
>
> http://econ2.potsdam.edu/dLearn/
>
> JM
| |
| john marshall 2006-11-11, 7:12 pm |
|
It's not that bad ... and absolutely worth it. I've created solutions that I could not have with Access, etc.
Plus, there is a fantastic set of people here to assist in getting over that curve faster!
jm
Clay Wrote:
> John,
>
> I really appreciate your suggestion. It gives me a great place to start. And thanks for the link to the dBASE Online Learning page. It looks like a great site, and it's one that I have not seen before. I'll definitely look over the Getting Started secti
on. Hopefully it will help me get over what I'm finding is a very steep learning curve.
>
> Thanks, Clay
>
> John Marshall Wrote:
>
>
|
|
|
|
|