Guides · For agents
Change a column's value where a condition is true
Ask your agent to run Sift's set_if fix: name the column, the new value and the condition, like an IF-then rule in a spreadsheet. Only rows that meet the condition change. In the test bookings file, the 2 pending bookings of 4 nights or more are set to review.
Ask your agent
With Sift connected (setup takes three steps), paste this and swap in your own paths.
Use Sift with /path/to/rules.bookings.json on /path/to/bookings_export.csv. Dry run set_if on the status column: set it to review where status is pending and nights is 4 or more. Tell me how many rows met the condition, then apply it if I say yes.
Your agent writes the condition like this: {"all": [{"field": "status", "op": "eq", "value": "pending"}, {"field": "nights", "op": "gte", "value": 4}]}.
2 of 10 rows is 20%, exactly the usual limit in this rules file ({"guardrails": {"stop_if_share_of_rows_changed_over": 0.2}}), so it goes through. Sift only stops when the share is over the limit. A condition that picks out more rows needs a higher limit, in the rules file or for one job with maxShareChanged.
What Sift sends back
The receipt keeps the value and the condition, so anyone can see which rule changed which rows.
What a condition can say
Equal or not equal, in or not in a list, blank or not blank, and greater or less than a number. Combine them with all, any and not. Text must match exactly.
Date conditions work both ways: within_days (0 to N days before the date you give), older_than_days, and due_within_days (0 to N days after it, for things due soon). Sift never uses today's clock, so give an as-of date. A date that could be either way round is flagged, and its row is left as it is.
What to do next
- Read the condition count in the dry run before you apply. If it is not what you expected, the condition is wrong, not the file.
- To fill blanks on every row, use blank_to instead. See fill blank cells in a CSV.
- Keep the receipt with the new file. It records every old and new value.
Questions
Yes. The condition can read any column of the same file, and the change goes in the column you name.
No. Sift never uses the clock. Give an as-of date, so the same run gives the same answer tomorrow.
Fixes work on CSV, which is what makes the undo exact. Save the sheet as CSV first, then point your agent at the CSV.
One file, no agent? Clean a file by hand in your browser, with nothing uploaded.