Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lookup one changes in rl #339

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions help/en/docs/references-lookups.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,22 @@ The entire formula would be `Sponsors.lookupOne(Contact_Email=$Registration_Emai

Now, we have the Sponsor Level listed in the All Registrations table for those attendees whose emails also appear on the sponsor list.

## lookupOne and sort_by

Now, let’s say we added a date column as the event has stretched over the course of a few days and we want to see when an attendee has been present. We could use the following formula to illustrate an example to find the earliest interaction associated with a specific contact:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the earliest interaction associated with a specific contact:
Sponsors.lookupOne(Contact_Name=$id, sort_by="Date")

The language talks about looking up an interaction, but the example looks up a sponsor. Looking earlier, it's referring to this example https://public.getgrist.com/6kTypo2FtSsf/Event-Sponsors-Attendees-References-and-Lookups/m/fork/p/2 where the Sponsors table doesn't have a Date column, and unclear what sense it would have if one were added. I think this illustration example would leave the reader confused, no?


```
Sponsors.lookupOne(Contact_Name=$id, sort_by="Date")
```

Specifically, `sort_by` causes multiple results to be sorted by Date, in ascending order, and since `lookupOne` returns the first of the matches, it becomes the earliest date.

Additionally, we can use the (-) symbol and reverse the order, finding the latest interaction:

```
Sponsors.lookupOne(Contact_Name=$id, sort_by="-Date")
```

## Understanding record sets

Sometimes a record may reference multiple records in another table. Multiple references can be made with a Reference List Column.
Expand Down