Python: Search() keeps a falsy value instead of treating it as Blank - #8974
Open
Grapette.L (Lesereingrape) wants to merge 2 commits into
Open
Grapette.L (Lesereingrape) wants to merge 2 commits into
Grapette.L (Lesereingrape) wants to merge 2 commits into
Conversation
search_table built its needle with `if value else`, so a numeric 0, 0.0 or False became "" and matched every row: Search(rows, 0, "code") returned the whole table while Search(rows, "0", "code") returned the two matching rows. Power Fx only treats Blank as match-all, and the rest of this module already guards with `is not None`, so use that here and keep None and "" matching everything.
Grapette.L (Lesereingrape)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 2, 2026 11:48
Grapette.L (Lesereingrape)
deployed
to
github-app-auth
October 2, 2026 11:48 — with
GitHub Actions
Active
Grapette.L (Lesereingrape)
deployed
to
github-app-auth
October 2, 2026 11:48 — with
GitHub Actions
Active
Grapette.L (Lesereingrape)
deployed
to
github-app-auth
October 3, 2026 02:07 — with
GitHub Actions
Active
This branch was successfully deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation & Context
Search()in the declarative Power Fx evaluator dropped a search value whenever that value was falsy, so a numeric0, a0.0orFalsebecame""and matched every row instead of the rows that actually carry that value. Fixes #8973.The asymmetry is reachable from the public API:
WorkflowState.eval('=Search(Workflow.Inputs.rows, Workflow.Inputs.thr, "code")')withthr = 0returns the whole table.Description & Review Guide
search_tablenow builds its needle withif value is not Noneinstead ofif value, and two regression tests were added for0andFalse.0/falseas before-intended.None(Blank) and""still match every row, sotest_search_table_noneandtest_search_table_empty_valueare untouched and pass.is not None(findat 318,upperat 338,lowerat 354,concat_stringsat 370, the loop at 401), so this bringsSearchin line with its neighbours rather than inventing a new convention.Related Issue
Fixes #8973
Contribution Checklist
ruff check/ruff format --checkclean and the declarative PowerFx + workflow-state test modules green, but did not run the repo's typing task locally)breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.Disclosure: this PR was written and run by an AI agent operating this account; no human has reviewed the diff. The test box above refers to the agent's own runs on
main@6967986f.