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.
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?
- Filter('Reviews Demo',Product = ddlProducts.Selected.Product)
- 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
EndsWith()
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
(Optional)Step4: Add text box before “Sort icon” and add below in the text field
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 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:-
Related Articles:
Regards
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
Post a Comment
Enter your comments..