Download P 4 - a2
Transcript
UPDATE FROM
|
|Set( _SET_UNIQUE, "ON"
| "OFF" | lToggle
«
)
|
|
|UPDATE FROM xcAlias ON expKey
|
|SET WRAP ON
֒→WITH exp
| OFF | xlToggle|
REPLACE idField1 ←֓
| "OFF" | lToggle
|__dbUpdate( cAlias, bKey,
)
|
[lRandom], [bReplacement]
)
|
Example:
SKIP
|__dbUpdate( "INVOICE", {|| LAST}, .T.,; {|| FIELD->TOTAL1 := ←֓
֒→INVOICE->SUM1,; FIELD->TOTAL2 := INVOICE->SUM2 } )
|
|SKIP
[
][
nRecords
|
]|
ALIAS idAlias nWorkArea
USE
«
|
|USE
|
|
|[idAlias|nWorkArea ->
«
[RANDOM]
]|
idField2 WITH exp ...
|
|
|Set( _SET_WRAP, "ON"
«
[,
](
[
]
dbSkip( nRecords ) )
|
SORT
|
|dbclosearea()
|
|
|SORT TO xcDatabase ON idField1
[C]] ...]←֓
֒→[scope] [WHILE
[/[A|D][C]] [,
idField2
[/[A|D]
|
|USE
] [FOR
lCondition
]
[
[
] [ALIAS
] [ ] ←֓
[
] [VIA cDriver]]|
] [EXCLUSIVE|
xcAlias
SHARED
NEW
֒→ READONLY
|
|__dbSort( cDatabase,
[acFields], [bForCondition], [bWhileCondition]
,←֓
֒→ nNextRecords ,
[
] [nRecord], [lRest]
|
)
|
[lNewArea], [cDriver],
[lReadOnly] |)
|dbUseArea(
,
«
[
xcDatabase ←֓
֒→ INDEX xcIndex1 , xcIndex2 ...
]|
lCondition
STORE
cDatabase,
[cAlias], [lShared]
|
|
|[dbSetIndex( cIndex1 )]
|STORE value TO variable
|
|
|
|
|[dbSetIndex( cIndex2 )]
| variable := value
|
|
«
|
SUM
|...
|
|
|SUM nExp1 , nExp2 ... TO idVar1 , idVar2 ...
֒→ WHILE lWhileCondition
NEXT nNextRecords
[
]
[
[
] [FOR lForCondition]←֓
] [RECORD nRecord] [
][
|
, idVar2:=idVar2+nExp2 ... },←֓
֒→{||lForCondition}, {||lWhileCondition}, nNextRecords, nRecord, lRest )
|dbZap()
|
Step 6: free yourself from STD.CH - /U
|dbeval( {||idVar1:=idVar1+nExp1
[
]
|
|
«
TOTAL ON
|
|TOTAL ON expKey
[
[FIELDS idField_list]
] [FOR lCondition]|
TO xcDatabase
[scope]←֓
֒→ WHILE lCondition
]
] [
[acFields], [bForCondition], [
bWhileCondition ,←֓
֒→ nNextRecords , nRecord ,
[
] [lRest]
UNLOCK
Now that no command is used, the standard include file ‘STD.CH’
is no more necessary. Clipper uses ‘STD.CH’ automatically, unless
specified differently. Just compile this way:
C:>CLIPPER TEST.PRG /U [ Enter ]
|
|__dbTotal( cDatabase, bKey,
«
«
|
|ZAP
|
] [ALL]|
REST
«
ZAP
)
|
Step 7: take control over all include files
«
Clipper comes with so many include files (‘*.CH’). To avoid confusion, a single ‘STANDARD.CH’ file containing all what is needed
for the application may be prepared. At least, it is necessary the
following.
|*=================================================================
|* DISPBOX()
|*=================================================================
|
|* Single-line box
|#define BOX_SINGLE;
|
(;
|
CHR(218) +;
|
CHR(196) +;
|
CHR(191) +;
|
CHR(179) +;
|
CHR(217) +;
|
CHR(196) +;
|
CHR(192) +;
|
CHR(179);
|
)
|
|
|UNLOCK
|
|
|dbUnlock()
|
|
|UNLOCK ALL
|
|
|dbUnlockAll()
|
1276
1277