Hello, Steve!
1. There is no DbServer:ClearOrder method (see SDK CA-Vo28).
2. On syntax some bArrayServer methods differ from the DbServer
methods. I showed it in the article.
=> There is no complete compatibility. The ClearOrder method in the
class DbServer is absent. Means, we can make it how it is convenient
to us.
The most similar method – DbServer:ClearIndex. Most likely, it also is
taken as a basis by bArrayServer:ClearOrder development. Besides,
DbServer:ClearIndex is similar to the old DBClearIndex function.
Question: whether to read attempt to clear to (close) the warrant with
nonexistent number an error?
I agree with Dick that ideologically it is correct, but it is
inconvenient. Why? At least because doesn't match on operation
DBClearIndex (see Help CA-Vo 28):
DBClearIndex() Function
Purpose: Remove orders from the order list in a work area and close
associated index files.
Syntax: DBClearIndex ([<cOrder> | <nPosition>], [<cIndexFile>]) --->
lSuccess
Arguments:
<cOrder> | <nPosition>
The name of the order to clear or a number representing its position
in the order list. Using the order name is the preferred method since
the position may be difficult to determine using multiple-order index
files. If not specified, all orders in the specified index file (or
the entire work area, if no index file is specified) are cleared.
Invalid values are ignored.
We check:
Use Test
Test->DBCLEARINDEX( 5 ) => TRUE :))
Dick insists on ideology. I offered a compromise.
In this case, Dick will make so:
IF .NOT. oServer:ClearOrder() <> BAS_OK
=> Error
I will make so:
IF oServer:ClearOrder() == BAS_ERROR
=> Error
It doesn't mean that I am right. I do how it is convenient to me.
Today I made one more editing and at me it looks so:
METHOD ClearOrder( iOrderNo ) CLASS msArrayServer // Valery
IF SELF:iOrderCount = 0
RETURN TRUE // BAS_WARNING
ELSEIF IsNil( iOrderNo )
iOrderNo := 0
ELSEIF IsNumeric( iOrderNo )
IF iOrderNo > 0 .AND. .NOT. Between( iOrderNo, 1, SELF:iOrderCount )
RETURN TRUE // BAS_WARNING
ENDIF
ELSE
RETURN FALSE // BAS_ERROR
ENDIF
IF !SELF:Notify( NOTIFYINTENTTOMOVE )
RETURN FALSE // BAS_ERROR
ENDIF
SELF:Commit()
IF iOrderNo = 0
SELF:iOrderCount := 0
SELF:iOrderNo := 0
SELF:auOrder := {}
ELSE
SELF:iOrderCount -= 1
ADel( SELF:auOrder, iOrderNo )
ASize( SELF:auOrder, SELF:iOrderCount )
IF SELF:iOrderCount=0
SELF:iOrderNo := 0
ELSE
SELF:iOrderNo := 1
SELF:auOrder[ SELF:iOrderNo, BASOI_KEYNO ] :=
SELF:OrderKeyNoToRecord( SELF:iOrderNo, SELF:iRecNo )
ENDIF
IF SELF:iOrderNo = 0 .OR. SELF:auOrder[ SELF:iOrderNo, BASOI_KEYNO ]
= 0
SELF:SuspendNotification()
SELF:GoTop()
SELF:ResetNotification()
ENDIF
ENDIF
SELF:Notify( NOTIFYFILECHANGE )
RETURN TRUE // BAS_OK
Good luck!
Forgive, if the message was duplicated...