INCREMENT_VALUE Function
Syntax
Output_Value as B = increment_value(input as B)
Output_Value as C = increment_value(input as C)
Output_Value as D = increment_value(input as D)
Output_Value as N = increment_value(input as N)
Arguments
- inputBinary Character Date Numeric
The name of a variable.
Returns
- Output_ValueBinary Character Date Numeric
Returns the incremented value.
Description
Increments a value of any type. Character fields can be incremented. e.g. "AZ-9" becomes "BA-0"
Discussion
INCREMENT_VALUE() increments the input value by one. The INCREMENT_VALUE() function operators on Date, Character, Numeric, and Blob variables. The function returns the value "1" (C), 1 (B), or 1 (N) if variable of the same type is blank or uninitialized. If the variable is type date and the variable is uninitialized, the return value is {31/12/-471}.
Example
dim cs as C
dim os as C
cs = "AB"
os = increment_value(cs)
? os
= "AC"
dim num as N
dim onum as N
num = 12
onum = increment_value(num)
? onum
= 13.000000
dim bl as B
dim obl as B
bl = "abc"
obl = increment_value(bl)
? obl
= ABD
dim dd as D
dd = date()
increment_value(dd)
? dd
= {01/11/2003}Incrementing Blobs and Characters
INCREMENT_VALUE() increments alphanumeric characters in a string. It does not increment symbols. For example:
? increment_value("123")
= "124"
? increment_value("AA9")
= "AB0"
? increment_value("sandwich")
= "SANDWICI"
? increment_value("!@#$%^__007__&*()")
= "!@#$%^__008__&*()"
dim blob as b
dim result as b
blob = "1234____ZZ"
result = increment_value(blob)
? result
= 1235____AAINCREMENT_VALUE() will not increase the length of a Character string or a Blob when a value is incremented if the input variable is not blank. For example:
? increment_value("ZZ")
= "AA"
dim blob as b
dim result as b
blob = "ZZZ"
result = increment_value(blob)
? result
= AAASee Also