-
Notifications
You must be signed in to change notification settings - Fork 22
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
clarify interpretation of less and greater as before/after #461
Open
combinatorist
wants to merge
4
commits into
gristlabs:master
Choose a base branch
from
combinatorist:feature/le-ge-as-before-after
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,13 +120,18 @@ Table.lookupRecords(..., order_by=("Foo", "Bar")).find.le(foo, bar) | |
|
||
If the `find` attribute is shadowed by a same-named user column, you may use `_find` instead. | ||
|
||
> :warning: In the following methods, "less" is best understood as "before" | ||
> and "greater" is best understood as "after". | ||
> For example, if you use a negative `order_by` on a simple integer column, | ||
> then the meaning of less than and greater than will be flipped. | ||
|
||
The methods available are: | ||
|
||
- __`lt`__: (less than) find nearest record with sort values < the given values | ||
- __`le`__: (less than or equal to) find nearest record with sort values <= the given values | ||
- __`gt`__: (greater than) find nearest record with sort values > the given values | ||
- __`ge`__: (greater than or equal to) find nearest record with sort values >= the given values | ||
- __`eq`__: (equal to) find nearest record with sort values == the given values | ||
- __`lt`__: (less than) find nearest (last) record with sort values < (before) the given values | ||
- __`le`__: (less than or equal to) find nearest record with sort values <= (last before or first equal) the given values | ||
- __`gt`__: (greater than) find nearest (first) record with sort values > (after) the given values | ||
- __`ge`__: (greater than or equal to) find nearest (first) record with sort values >= (equal or after) the given values | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one should be "first equal or after", though I think this is clear as is. Maybe |
||
- __`eq`__: (equal to) find nearest (first) record with sort values == the given values | ||
|
||
Example from [our Payroll template](https://templates.getgrist.com/5pHLanQNThxk/Payroll). | ||
Each person has a history of pay rates, in the Rates table. To find a rate applicable on a | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should actually be "last that's before or equal" -- if you have multiple equal values to the one you are looking up, it should return the last of these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to edit this PR to so the phrasing is more accurate. I was just pointing out that it wasn't clear to without these details. If it feels cleaner to you, maybe you could these alternative explanations somewhere else and link to that.