-
-
Notifications
You must be signed in to change notification settings - Fork 508
Open
Description
Describe the current behavior
When the user uses Table.lookupRecords(key=value).ReferencedColumn in a situation where there is no match, the formula returns a list instead ot a RecordSet. This can introduce edge cases that make the python formula fail.
Steps to reproduce
- Create a "Rooms" table
- Add a column "Name" and add "Room A" and "Room B" items
- Create a "Objects" table
- Add a column "Name" and a column "Room" that references the first table
- Add a single item: a needle in "Room A"
- Go back to the "Rooms" table and add a formula column with this content:
type(Objects.lookupRecords(Room=$id).Room) - Observe that it is equal to
RecordSetfor "Room A" andlistfor "Room B"
Here is the code view:
import grist
from functions import * # global uppercase functions
import datetime, math, re # modules commonly needed in formulas
@grist.UserTable
class Objects:
Name = grist.Text()
Where = grist.Reference('Rooms')
@grist.UserTable
class Rooms:
Name = grist.Text()
def Items(rec, table):
return None
Describe the expected behavior
The engine should return the same type for both, probably a RecordSet
Where have you encountered this bug?
- On docs.getgrist.com
- On a self-hosted instance
Instance information (when self-hosting only)
N/A
dsagal
Metadata
Metadata
Assignees
Labels
No labels