Home > Archive > Getting Started with dBASE > August 2005 > Replace command









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 Replace command

2005-08-16, 1:24 pm



I have a problem in Dbase plus with fields without value (empty fields). For
example I have a table XY with numeric fields DEBET, KREDIT, SALDO and the
value of SALDO of currrent rowset is the value of SALDO of previous rowset
+ DEBET - KREDIT of current rowset.

In 5.7 version I use the following code:
msaldo1=0
mdebet=debet
mkredit=kredit
msaldo=mdebet-mkredit
msaldo1=msaldo1+msal
do
replace saldo with msaldo1

In dBase plus this code does not work when the value of a field (debet or
kredit) is emply. And when copying or appending tables usually the values
with 0 (zero) value are copied as empty field values.

I probably do something wrong. I shall appreciate any suggestions.

Anton Klepec
------------------------------------------
AKC d.o.o.
Ljubljana
Kavškova 13
tel. 01 515 3193
www.akc.si






Denis Finch

2005-08-16, 1:24 pm

with dbase plus and using table level 7 the fields can hold a null value.
So when you add a null value to value you get null.

so you have to check for null values
msaldo1 = 0
if mdebet = null
mdebet = 0
else
mdebet = debet
endif
and so on.
<finance@akc.si> wrote in message news:sqM6f7koFHA.2024@news-server...
>
>
> I have a problem in Dbase plus with fields without value (empty fields).

For
> example I have a table XY with numeric fields DEBET, KREDIT, SALDO and the
> value of SALDO of currrent rowset is the value of SALDO of previous

rowset
> + DEBET - KREDIT of current rowset.
>
> In 5.7 version I use the following code:
> msaldo1=0
> mdebet=debet
> mkredit=kredit
> msaldo=mdebet-mkredit
> msaldo1=msaldo1+msal
do
> replace saldo with msaldo1
>
> In dBase plus this code does not work when the value of a field (debet or
> kredit) is emply. And when copying or appending tables usually the values
> with 0 (zero) value are copied as empty field values.
>
> I probably do something wrong. I shall appreciate any suggestions.
>
> Anton Klepec
> ------------------------------------------
> AKC d.o.o.
> Ljubljana
> Kavškova 13
> tel. 01 515 3193
> www.akc.si
>
>
>
>
>
>



Gerald Lightsey

2005-08-16, 1:24 pm

On Tue, 16 Aug 2005 12:34:31 +0200, in the dbase.getting-started group,
said...
>
>
> I have a problem in Dbase plus with fields without value (empty fields). For
> example I have a table XY with numeric fields DEBET, KREDIT, SALDO and the
> value of SALDO of currrent rowset is the value of SALDO of previous rowset
> + DEBET - KREDIT of current rowset.
>
> In 5.7 version I use the following code:
> msaldo1=0
> mdebet=debet
> mkredit=kredit
> msaldo=mdebet-mkredit
> msaldo1=msaldo1+msal
do
> replace saldo with msaldo1
>
> In dBase plus this code does not work when the value of a field (debet or
> kredit) is emply. And when copying or appending tables usually the values
> with 0 (zero) value are copied as empty field values.
>
> I probably do something wrong. I shall appreciate any suggestions.


Check your on-line Help under the topic autonull fields/null values.
There is a setting for this as well as a command if you go to the IDE
menu and click...
Properties|Desktop Properties|Table|Aut
oNullFields

This is only a factor if you are using level 7 .DBF tables. Lower table
levels such as you used in VdB 5.x have never had the ability to accept
null numeric values and still don't/won't.

Gerald
Rachhpal

2005-08-17, 8:23 pm

When you create new table set default value to 0. I dont understand why for numeric field the default value is not zero automatically. Presently it is null. There must be a reason if somebody can explain.

Rachhpal


Denis Finch Wrote:

> with dbase plus and using table level 7 the fields can hold a null value.
> So when you add a null value to value you get null.
>
> so you have to check for null values
> msaldo1 = 0
> if mdebet = null
> mdebet = 0
> else
> mdebet = debet
> endif
> and so on.
> <finance@akc.si> wrote in message news:sqM6f7koFHA.2024@news-server...
> For
> rowset
>
>


Todd Kreuter [dBVIPS]

2005-08-18, 8:23 pm

"Rachhpal" <rachhpalg@yahoo.com> wrote in message
news:$ka0gV3oFHA.1796@news-server...
> When you create new table set default value to 0. I dont understand why

for numeric field the default value is not zero automatically. Presently it
is null. There must be a reason if somebody can explain.

A null is a better representation of a virgin value, a value that the user
has not touched. Users can enter zeros and spaces, but not nulls. Yes we
have to go an extra step to deal with them, but they do serve some purpose.
I find null quite useful, not so much as field values but for the ability to
check any data type against null.

Todd Kreuter [dBVIPS]


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com