mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
Updates to Grist Functions (#125)
Clarify documentation for QUOTIENT, SUMPRODUCT, UUID, REPLACE, lookupOne, lookupRecords, and $group.
This commit is contained in:
@@ -550,7 +550,7 @@ def PRODUCT(factor1, *more_factors):
|
||||
|
||||
def QUOTIENT(dividend, divisor):
|
||||
"""
|
||||
Returns one number divided by another.
|
||||
Returns one number divided by another, without the remainder.
|
||||
|
||||
>>> QUOTIENT(5, 2)
|
||||
2
|
||||
@@ -797,7 +797,8 @@ def SUMIFS(sum_range, criteria_range1, criterion1, *args):
|
||||
|
||||
def SUMPRODUCT(array1, *more_arrays):
|
||||
"""
|
||||
Multiplies corresponding components in the given arrays, and returns the sum of those products.
|
||||
Multiplies corresponding components in two equally-sized arrays,
|
||||
and returns the sum of those products.
|
||||
|
||||
>>> SUMPRODUCT([3,8,1,4,6,9], [2,6,5,7,7,3])
|
||||
156
|
||||
@@ -859,7 +860,13 @@ def TRUNC(value, places=0):
|
||||
return ROUNDDOWN(value, places)
|
||||
|
||||
def UUID():
|
||||
"""Generate a random UUID-formatted string identifier."""
|
||||
"""
|
||||
Generate a random UUID-formatted string identifier.
|
||||
Since UUID() produces a different value each time it's called, it is best to use it in
|
||||
[trigger formula](https://support.getgrist.com/formulas/#trigger-formulas) for new records.
|
||||
This would only calculate UUID() once and freeze the calculated value. By contrast, a regular [formula]
|
||||
may get recalculated any time the document is reloaded, producing a different value for UUID() each time.
|
||||
"""
|
||||
if six.PY2:
|
||||
return str(uuid.UUID(bytes=[chr(random.randrange(0, 256)) for _ in xrange(0, 16)], version=4))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user