0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

StartsWithの罠

Posted at

StartsWithは結構便利でTextInputコントロールのTextで
Galleryの検索に利用したりするがこの前罠に嵌ってしまった。

下記2つのリスト
PostListとMemberListがあるとする。
MemberリストのPostNoにはPostListから引用したNoを記載する。
(検証の為にPost列も作成している)

image.png

次に
Post名をそのままStartsWithでフィルターをかけたものと
PostNoをLookUpで引用しStartsWithにてフィルターしたものを比較してみる

image.png

ぱっと見はほぼ一緒に見えるのですが

image.png
image.png

TextInputのTextがmanaの時点でPostNoを引用したものに関してはLookUpの中身を見たらわかるのですが
TextInputのTextが""の時に、データが見つからない理由がわからなかった。

https://learn.microsoft.com/ja-jp/power-platform/power-fx/reference/function-startswith
Learnを参考にちょっと悩んでひらめいた!
image.png
あ、Textが空の場合はtrueを返す。つまりこれは""の場合
(前回のTTextInputコントロール Defaultプロパティ ""と空白のトラップ参照)
https://qiita.com/sionnct/items/fb15adb3fac4ea978b27
TextInputのTextが""の場合は、LookUpの式はBlankを返すのでデータが見つからないことが分かった。

ちなみにTextInputコントロールのDefaultプロパティを空白にするとtrueを返さなくなりデータが見つからなくなる。
image.png
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?