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?

More than 1 year has passed since last update.

【Power Apps】LookUp関数を利用してラベルに特定レコードのフィールド値を表示する

Last updated at Posted at 2021-10-18

当初Filter関数を用いて表を表示させたアプリを作成していました。UI変更でラベル入力値を用いてテーブルの値をFilterできないか、と苦心していました。が、比較項目の型を統一するというのは筋が悪そうだと諦め(テーブルはレコード型になる)、テーブルではなくラベルに表示できないかという観点で調べました。

Filter以外にもSearchやLookUpもある

結果、たどり着いたのはMS Learnでした

※2020/11まで、とありますので参照時期によっては最新のLearnをご確認ください。

この教材の中に構文

LookUp(collectCustomerInvoices, ID =3).Amount

がありましたので、こちらを参考に解決することができました。(値比較で数値に変換が必要な場合はValue関数を用います)

技術ブログやDocsのリファレンス検索で行き詰まった場合はLearnに立ち返るのがいいのかもしれません。

実際の使い方

Label1とLabel2の形式は日付型で一致しています。

スクリーンショット 2022-09-29 145405.png

プロパティ
Label1.Text LookUp(Table,ID=nn,開始日)
Label2.Text Today()
Label3.Text "開始前です"
Label3.Visible If(DateDiff(Label1.Text,Label2.Text)<0,true,false)
※上の例ではDateDiff(Label1.Text,Label2.Text)の結果は-4になります。開始日が到来したら非表示になります

スクリーンショット 2022-09-29 164547.png

プロパティ
Label1.Text LookUp(Table,ID=nn,終了日)
Label2.Text Today()
Label3.Text "既に終了しています"
Label3.Visible If(DateDiff(Label2.Text,Label1.Text)<0,true,false)
※上の例ではDateDiff(Label2.Text,Label1.Text)の結果は-3になります。終了日前は非表示。
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?