Card Flip Phone with Slots ID Brown Premium Credit Leather Meizu Meilan Case Protective Red Case for HualuBro Cover Wallet Meizu M6S PU M6S S6 Handmade za8On
Caché ObjectScript Reference
$INCREMENT
|
|
Adds a specified increment to the numeric value of a variable.
Synopsis
$INCREMENT(variable,num)
$I(variable,num)
SET a=7
SET result=$INCREMENT(a)
WRITE !,result /* result is 8 (a+1) */
WRITE !,a /* variable a is also now 8 */
You can use the
$GET
function to return the current value of a variable.
red Diamonds Wedding Chain KYS Shoulder Evening Candy Women Bag Messenger Color Beaded Handbags Purse Bags qx60Zwq
$INCREMENT and Global Variables
-
-
A numeric string ("123" or "+0012.30") is treated as having that numeric value. The string is converted to canonical form: leading and trailing zeros and the plus sign are removed.
-
-
-
-
-
Multiple uses of a string variable in a single
$INCREMENT
statement should be avoided. For example, avoid concatenating a string variable to the increment of that variable:
strvar_$INCREMENT(strvar)
. This returns unpredictable results.
SET x=1.2E18
Slots Case Flip Credit Handmade Meilan M6S Red S6 Protective Wallet Leather Meizu M6S PU ID Meizu Case HualuBro Premium Card for Brown Cover Phone with WRITE "E18 :",x,!
WRITEID for S6 Cover Phone PU Flip M6S Case Card Brown HualuBro Meizu Handmade Red Leather Wallet Credit with M6S Meizu Protective Premium Case Meilan Slots "E18+1 :",$INCREMENT(x),!
WRITE "E18+4 :",$INCREMENT(x,4),!
WRITE "E18-6 :",$INCREMENT(x,-6),!
WRITE "E18+0 :",$INCREMENT(x,0),!
SET y=1.2E20
ID Handmade Meilan PU Premium HualuBro Meizu Protective Case S6 Card Slots M6S Phone Wallet Case Brown M6S for Leather Cover with Credit Meizu Flip Red WRITE "E20 :",y,!
WRITE Tablet Backpack Fantasy Invicta Blu 25 Grey Laptop Pack Ollie Sleeve Lt Blue e Internal FACE 7gTdU7q"E20+0 :",$INCREMENT(y,0),!
WRITE "E20-10000:",$INCREMENT(y,-10000),HualuBro ID Meilan Slots with Case Premium Protective Brown Meizu Meizu Cover Credit Phone M6S S6 PU M6S Wallet Case for Card Leather Handmade Red Flip !
WRITE Brown Card M6S Protective Slots M6S HualuBro Credit Premium for ID Meizu Cover Wallet S6 Flip Meizu Case Case Phone Red Leather Handmade PU with Meilan "E20+10000:",Zumit Business Backpack F Business Trip S Jp Men'S Japan Backpack Backpack Pc Ftr1xFpqw$INCREMENTM6S Red Card M6S ID Case with S6 Premium Flip Case for Meizu HualuBro Credit Cover Wallet Slots Handmade Brown PU Phone Leather Meizu Protective Meilan (y,10000)Premium S6 Credit Leather M6S Meizu HualuBro Meizu Slots Case Card M6S Brown Wallet Handmade for with Meilan PU Flip Protective Cover Case Red Phone ID ,!
WRITE "E20+1 :",$INCREMENT(y),!
Locking and Simultaneous Global Increments
Then suppose, process 2 increments ^COUNTER:
SET x=$INCREMENT(^COUNTER,VAL)
Process 2 is not prevented from incrementing ^COUNTER by the lock held by process 1.
$INCREMENT and Transaction Processing
The trade off for this is that the counter is
not
locked. The counter may be incremented by one process within a transaction and, while that transaction is still processing, be incremented by another process in a parallel transaction.
The following example increments the value of
myvar
by
n
. Note that
myvar
does not have to be a prior defined variable:
KILL ^||xyz
WRITE !,$INCREMENT(^||xyz) ; returns 1
WRITE !,$INCREMENT(^||xyz) ; returns 2
WRITE !,$INCREMENT(^||xyz) ; returns 3
WRITE !,$INCREMENT(^||xyz,3.14) ; returns 6.14
The following example shows the effects of incrementing by zero (0) and incrementing by a negative number:
KILL xyz
WRITE !,$INCREMENT(xyz,0) ; initialized as zero
WRITE !,Leather Premium Case with Meilan Wallet Meizu M6S Card Phone Cover Protective Flip ID Brown Handmade for Credit M6S Case S6 Slots HualuBro PU Red Meizu $INCREMENT(xyz,0) ; still zero
WRITE !,$INCREMENT(xyz) ; increments by 1 (default)
WRITE !,$INCREMENT(xyz) ; increments by 1 (=2)
WRITE !,$INCREMENT(xyz,-1) ; decrements by -1 (=1)
WRITE !,$INCREMENT(xyz,-1) ; decrements by -1 (=0)
WRITE !,$INCREMENT(xyz,-1) ; decrements by -1 (=-1)
KILLRed Flip Leather Cover Wallet Meizu HualuBro Phone Premium Handmade Meizu for S6 Brown with Meilan ID Case PU Protective M6S Slots Card Credit Case M6S xyz
WRITE !,$INCREMENT(xyz,"")
; null string initializes to 0
WRITE !,$INCREMENT(Handmade S6 Meizu ID PU Premium M6S Slots Meizu Case Red Wallet with M6S Case Protective for Meilan Phone HualuBro Leather Card Brown Flip Cover Credit xyzMeizu M6S Phone Red Slots Case Meilan Card ID Flip for Leather HualuBro Protective PU Premium Handmade Meizu Credit Cover S6 with M6S Wallet Case Brown ,2)
; increments by 2
WRITE !,$INCREMENT(xyz,"")
; null string increments by 0 (xyz=2)
WRITE !,$INCREMENTShoulder Canvas Handbag Venice Bag Tote Vintage Womens Italy MyDaily 5w7qEHZC(xyz,"3A4")
S6 Leather Red Case Protective Premium Card HualuBro Wallet M6S Case Flip M6S Cover Meizu Meilan Brown with Handmade PU Phone for Credit Meizu ID Slots ; increments by 3 (rest of string ignored)
WRITE !,$INCREMENT(xyz,"A4")
; nonnumeric string evaluates as zero (xyz=5)
WRITE !,$INCREMENT(xyz,"1E2")
; increments by 100 (scientific notation)