演習 - Power Apps の MR で測定とフィルター処理

完了

このユニットでは、 Power Apps の主要な機能コンポーネントの一部を使用します。 これには、MRでの測定とフィルタリング方法が含まれます。 ユーザーは、Power Apps の MR で測定コンポーネントを使用して、現実世界の距離、面積、体積を測定できます。

MR の Measure を使用した空間フィルター処理

MR の測定機能は、測定セッションで受け取った測定値に従って、現実世界に簡単に配置できる製品を空間的にフィルター処理するために使用されます。 一部の基本的な数式は、フィルター処理を実行するために使用されます。

  1. ホーム ページに移動します。 [ 挿入 ] タブで、[ Mixed Reality ] ドロップダウンを展開し、[ MR で測定 ] を選択します。

    MR で測定を追加するスクリーンショット

  2. 図に示すように「MRで計測」ボタンを配置し、次のプロパティを構成します。

    • テキスト: ディメンションでフィルター処理
    • 測定単位: センチメートル
    • 測定タイプ: フリーフォーム

    MR で Measure のプロパティを構成するスクリーンショット。

  3. ホーム ページで、ギャラリー> を選択してギャラリーを追加します。 ギャラリーの名前をMeasure_galleryに変更します。

    ギャラリーを追加するスクリーンショット。

  4. [ディメンションでフィルター] ボタンのすぐ下に垂直ギャラリーを配置します。 [タイトル]、[サブタイトル]、および [本文] を選択して、Layout プロパティを構成します。

    レイアウトを構成するスクリーンショット

  5. 次の行を追加して、Measure_galleryItems プロパティを構成します。

    MeasureInMR1.Measurements
    

    ギャラリー データ ソースのスクリーンショット。

  6. 区切り記号NextArrow を削除します。 画像に示すように、 タイトルサブタイトルおよび本文 を互いに等間隔に配置します。

    等間隔配置のスクリーンショット。

  7. 次のように、3 つのラベルの Text プロパティを構成します。

    • タイトル:

      "Unit: "&ThisItem.Unit
      

      タイトル テキストのスクリーンショット

    • サブタイトル:

      "Area: "&ThisItem.Area&"cm²"
      

      サブタイトル テキストのスクリーンショット。

    • 本文:

      "Height: "&ThisItem.Height&"cm"
      

      本文のスクリーンショット。

  8. [ 再読み込み ] アイコンを追加して、ユーザーが満足できない場合に測定値をやり直しましょう。 [ 挿入 ] タブで、[ アイコン ] ドロップダウンを展開し、[ 再読み込み ] アイコンを選択します。

    再読み込みアイコンの追加のスクリーンショット。

  9. 画像に示すようにアイコンを配置し、次のように OnSelect プロパティを構成します。

    UpdateContext({galleryvisible:false});
    

    再読み込み用に OnSelect を構成するアイコンのスクリーンショット。

    ヒント

    アプリケーションのデザインに合わせて、フォント、フォント サイズ、およびフォント スタイルをカスタマイズできます。 ただし、ユーザー エクスペリエンスを向上するために、アプリケーション全体で一貫したフォントを維持します。

  10. MR内での測定が完全に構成された後、空間フィルタリングに移行します。 ここでは、MR セッションの Measure で受け取った WidthDepthHeight の値に基づいて、製品を空間的 フィルター処理します。

    [製品] ページに移動し、Gallery_productsItems プロパティを次のように構成します。

    If(
    ID = 1 And Measure_gallery.Selected.Height = 0,
    (Filter('Easy Sales',(ProductCategory = "Sofa") And ((Depth < Measure_gallery.Selected.BoundingDepth And Width < Measure_gallery.Selected.BoundingWidth) Or (Depth < Measure_gallery.Selected.BoundingWidth And Width < Measure_gallery.Selected.BoundingDepth)))),
    ID = 1 And Measure_gallery.Selected.Height > 0,
    (Filter('Easy Sales',(ProductCategory = "Sofa") And ((Depth < Measure_gallery.Selected.BoundingDepth And Width < Measure_gallery.Selected.BoundingWidth And Height <= Measure_gallery.Selected.Height) Or (Depth < Measure_gallery.Selected.BoundingWidth And Width < Measure_gallery.Selected.BoundingDepth And Height <= Measure_gallery.Selected.Height)))),
    ID = 1,
    Filter('Easy Sales',ProductCategory = "Sofa"), 
    
    ID = 2,
    Filter('Easy Sales',ProductCategory = "Chair"), 
    ID = 2 And Measure_gallery.Selected.Height = 0,
    (Filter('Easy Sales',(ProductCategory = "Chair") And ((Depth < Measure_gallery.Selected.BoundingDepth And Width < Measure_gallery.Selected.BoundingWidth) Or (Depth < Measure_gallery.Selected.BoundingWidth And Width < Measure_gallery.Selected.BoundingDepth)))),
    ID = 2 And Measure_gallery.Selected.Height > 0,
    (Filter('Easy Sales',(ProductCategory = "Chair") And ((Depth < Measure_gallery.Selected.BoundingDepth And Width < Measure_gallery.Selected.BoundingWidth And Height <= Measure_gallery.Selected.Height) Or (Depth < Measure_gallery.Selected.BoundingWidth And Width < Measure_gallery.Selected.BoundingDepth And Height <= Measure_gallery.Selected.Height)))),
    
    ID = 3,
    Filter('Easy Sales',ProductCategory = "Table"),
    ID = 3 And Measure_gallery.Selected.Height = 0,
    (Filter('Easy Sales',(ProductCategory = "Table") And ((Depth < Measure_gallery.Selected.BoundingDepth And Width < Measure_gallery.Selected.BoundingWidth) Or (Depth < Measure_gallery.Selected.BoundingWidth And Width < Measure_gallery.Selected.BoundingDepth)))),
    ID = 3 And Measure_gallery.Selected.Height > 0,
    (Filter('Easy Sales',(ProductCategory = "Table") And ((Depth < Measure_gallery.Selected.BoundingDepth And Width < Measure_gallery.Selected.BoundingWidth And Height <= Measure_gallery.Selected.Height) Or (Depth < Measure_gallery.Selected.BoundingWidth And Width < Measure_gallery.Selected.BoundingDepth And Height <= Measure_gallery.Selected.Height))))
    )
    

    ソファで項目を構成するスクリーンショット。

    Von Bedeutung

    将来エラーが発生しないように、 SharePoint リストと ギャラリー に適切な名前を指定します。 混乱を避けるために、数式内のコンポーネントの名前を維持します。

    製品に固有の別の機能が追加されるため、[ カーペット ] ページには空間フィルタリングは含まれません。 MRセッションで測定された領域は、選択したカーペットの価格を見積もるために使用されます。

    ヒント

    アプリケーションを頻繁に保存するには、上部にある [ ファイル ] タブを選択し、[ 保存 ] オプションを選択します。 メッセージが表示されたら、[ クラウド ] オプションを選択し、[ 保存] を選択します。

面積に基づいて価格を計算する

  1. Carpet_details ページに移動し、ラベルを追加し、Area_carpets名前を変更します。

    エリア ラベルの追加のスクリーンショット

  2. Area_carpets ラベルの横に別の空のラベルを追加し、次のように空白ラベルの Text プロパティを構成して、計算された領域を表示します。

    Measure_gallery.Selected.Area&"cm²"
    

    エリア計算のスクリーンショット。

  3. 計算された価格を表示するには、 Price ラベルの横にあるラベルを次のように構成します。

    "$"&Measure_gallery.Selected.Area * content_carpets.'Price/cm2'
    

    価格計算のスクリーンショット。

上記の手順を実装すると、アプリケーションは製品を空間的に除外し、実際の測定値に基づいてカーペットの正確な価格を計算します。

mr と空間フィルター処理でメジャーを実装した後のアプリケーション デモのアニメーション。