Develop Powerapps from the Scratch - Series2/3

Hi All,

Here again with the Series 2. You can check out my previous series to contextually understand this one. Alright let’s get STARTED

Data source


Product
Title aka review Title
Review Description
Rating
Product 1
P1-Review 1
Long text…
5
Product 1
P1-Review 2
Long text…
4
Product 1
P1-Review 3
Long text…
2
Product 2
P2-Review 1
Long text…
4
Product 2
P2-Review 1
Long text…
1
Product 3
P3-Review 1
Long text…
5
Product 3
P3-Review 2
Long text…
1
Product 3
P3-Review 3
Long text…
3
Product 3
P3-Review 4
Long text…
5


Update Data source

Updated the SPList with the new column and value to support current series. Whenever modified we can refresh the data source explicitly




Adding Interaction

Add dropdown control from the ribbon









Step 1: Double click control
Step2: Rename it.

Note: This is applicable to all the controls.

let's add control for the following interaction
A.      Dropdown filtering (by Product name)
B.      Sorting(by modified date)

A.      Dropdown

Click dropdown and select “Items” in the formula box 


Run the application now


Now we need to map the list to show items base on the dropdown selection (i.e. Show list based on selected product)

Select the list 


There are couple of ways to do it let see How? & why?


  1. Filter('Reviews Demo',Product = ddlProducts.Selected.Product)
  2. Search('ReviewsDemo',ddlProducts.Selected.Product,"Product")

How?
Go to the formula bar and enter the 1st formula
Filter('Reviews Demo',Product = ddlProducts.Selected.Product)



Why?
We used “Filter” function to filter the items in the list for the better PERFORMANCE rather SCENARIO based.   Because we know the exact condition to filter out the rows from the rows. Confusing…? Okay, let’s drill down with the SQL Query example; to do the same set of filtering we   would use the below query
(i.e. select * from ReviewsDemo where Product = “Product Name”) this would give us a collection of exact matching rows or none.

When we use search function which is of generic or like type
Search('Reviews Demo',ddlProducts.Selected.Product,"Product")->SQL Query
Select * from ReviewsDemo where Product like ‘Prod%’ this would give us the match rows based on the generic input.
However we extend the convenience of search() with the below functions as needed
StartsWith()
EndsWith()

Note: SCENARIO is the key for choosing filter over search. Please refer here for more information.

B.      Sorting

Let’s see how to sort the list based on “Modified date” and will also see how to declare variables on the fly and use it across the app.

Step1: Select the Sort icon
Step2: Go to formula bar and enter the following
                UpdateContext({varSorting:!varSorting })
Step3: Now select the list (i.e. list of all reviews) and go to the formula bar then add the below
Sort(Filter('Reviews Demo', Product = ddlProducts.Selected.Result),Modified,If(varSorting, SortOrder.Descending, SortOrder.Ascending))


Remember previously we had this here



Both would return collection of items



(Optional)Step4: Add text box before “Sort icon” and add below in the text field



Step5: Run the application





Note: click below links for more information
Update context – Basically it will refresh/update the known type. Also create the new type.

C.      Add Rating

Select first item in the list then Go to Ribbon->Insert=>Rating



Select rating control and map the “Rating” column from the data source


Select the ‘Advanced’ tab and select ‘ReadOnly’ property to true.


Show runtime value in ‘Tooltip’


D.      Show review date


Note: Refer my earlier post for more information about HTML control.


Run the app


So, in this series (2/3) we saw how add interactions to the screen and usage of frequently used controls

In the next series will see below,
1.       View detailed review
2.       Add new review with rating
3.       And…?? More!!

Series 1 link:-
                Develop Powerapps from the Scratch - Series1/3

Ratsub
P.S: All the above mention step/explanation are totally my point of view based on my hand-on. Those are not necessarily to be the best bet there may be alternative steps and thoughts.

Comments

Popular posts from this blog

Secure When a HTTP request is received Power Automate a.k.a MS Flow

People picker Control in PowerApps

Upload attachment to SharePoint list item using Microsoft Flow

Approval and auto escalation with time out in Microsoft Flow

Modern page provisioning using page template

Headless-Daemon calling AAD secured API

Developing custom reusable components in PowerApps

Step-By-Step Azure AD App Registration

HTML field & Date Time formatting in powerapps

Create and configure custom connectors for PowerApps and MSFlow from AzureFunctions