gristlabs_grist-core/sandbox/grist/functions
Alex Hall c5ebd7db3d (core) Add PEEK() function to bypass circular dependencies
Summary:
Adds a Python function `PEEK()` for use in formulas which temporarily sets a new attribute `Engine._peeking` which disables the `_use_node` method, preventing dependency tracking and allowing the given expression to use outdated values. This allows circumventing circular reference errors. It's particularly meant for trigger formulas although it works in normal formulas as well. The expression is wrapped in a `lambda` by `codebuilder` for lazy evaluation.

Discussion: https://grist.slack.com/archives/C0234CPPXPA/p1653571024031359

Test Plan: Added a Python unit test for circular trigger formulas using PEEK.

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3453
2022-06-02 19:50:14 +02:00
..
__init__.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
date.py (core) Update the current time in formulas automatically every hour 2022-04-28 21:07:40 +02:00
info.py (core) Add PEEK() function to bypass circular dependencies 2022-06-02 19:50:14 +02:00
logical.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
lookup.py (core) A few tiny documentation tweaks. 2022-01-07 14:26:00 -05:00
math.py Tweaks to documentation comments for user-facing Grist functions (#126) 2022-02-13 00:45:24 -05:00
schedule.py (core) New type conversion in the backend 2022-02-04 20:28:13 +02:00
stats.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
test_schedule.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
text.py Tweaks to documentation comments for user-facing Grist functions (#126) 2022-02-13 00:45:24 -05:00
unimplemented.py (core) Improve suggestions for formula autocomplete 2020-09-12 00:21:29 -04:00