Skip to content

Commit b56e7d6

Browse files
committed
Published extend inspections app by adding hierarchy to locations
1 parent 6ffae38 commit b56e7d6

File tree

6 files changed

+384
-0
lines changed

6 files changed

+384
-0
lines changed
Lines changed: 384 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,384 @@
1+
---
2+
title: Add hierarchy to ___location of Inspection
3+
description: Learn about how the Inspection sample apps can be extended to add ___location of inspection
4+
author: sbahl10
5+
ms.service: powerapps
6+
ms.topic: conceptual
7+
ms.custom:
8+
ms.date: 06/15/2021
9+
ms.author: v-shrutibahl
10+
ms.reviewer: tapanm
11+
contributors:
12+
- v-ljoel
13+
---
14+
15+
# Inspections App – Add hierarchy to ___location of inspection
16+
17+
The Inspections Power Apps template allows users to create and perform inspections in the app. There are three apps, one per persona to perform,
18+
manage, and review Inspections. The three apps are – Inspections, Manage Inspections and Review Inspections.
19+
20+
By default the Inspection app is designed for a single store. But what if you perform inspections on multiple stores? You will want to add a table for stores to the app and let the user select the store in which they are performing inspections so that you can track at which store the inspection was performed.
21+
22+
In this topic we will learn how to update the app to add a hierarchy of stores so that inspections can be performed for different stores.
23+
24+
> [!NOTE] Before starting this topic, please review **How to customize Inspections** (insert link).
25+
26+
## Prerequisites
27+
28+
To complete this lesson, we would need the ability to login into Microsoft Teams which will be available as part of select Microsoft 365 subscriptions and will also need to have the Inspections Power Apps template for Microsoft Teams installed. This app can be installed from aka.ms/TeamsInspection.
29+
30+
## Edit the Inspections app
31+
32+
1. Login into Teams and right click Power Apps from the left menu and select **Pop out app**.
33+
34+
2. Select Build from the top ribbon.
35+
36+
3. Select the Team in which the Inspections app is installed.
37+
38+
4. Select Inspections to open the app in the editor.
39+
40+
5. The Inspections app opens.
41+
42+
### Add a new table called Store
43+
44+
1. Select **Data** from the left navigation menu.
45+
46+
2. Select **+Add data**.
47+
48+
3. Select the **+Create new table**.
49+
50+
4. Enter table name Store and select **Create**.
51+
52+
5. Select the **Add Column** button to add a new column.
53+
54+
6. Enter column name = Store Number and select **Create** – the column gets added.
55+
56+
7. Add a few records of data in the table and select **Close.**
57+
58+
![Store Table](media/extend-inspections-add-hierarchy-to-locations/store-table.png "Store Table")
59+
60+
### Add a column to capture Store in the Area Inspections table
61+
62+
1. Select **Data** from the left navigation menu.
63+
64+
2. Locate the Area Inspections table and hit on the three dots.
65+
66+
3. Select **Edit Data**.
67+
68+
4. The Area Inspections table opens.
69+
70+
5. Select **Add Column**, enter the Table name = Store, Type = Lookup, Related Table = Store.
71+
72+
6. Select **Create**.
73+
74+
7. The column gets added.
75+
76+
8. Select the **Close** button to close the table.
77+
78+
### Add a new screen with a Gallery of Stores
79+
80+
1. Select the Tree view from the left navigation menu.
81+
82+
2. Select **+New** screen from the tree view.
83+
84+
3. Select Blank layout.
85+
86+
4. The new screen gets added.
87+
88+
5. Rename the screen to **StoreSelectionScreen**.
89+
90+
6. Update the Fill property to **gblAppStyles.Background.Fill**.
91+
92+
7. Select the **+Insert** button to add a Gallery to the new screen.
93+
94+
8. Select Stores as the data source.
95+
96+
9. Gallery gets added to the new screen.
97+
98+
10. Rename the gallery to **StoresGallery**.
99+
100+
11. Update Template Size to **108**.
101+
102+
12. Update FontSize of Label Title4 to **20**.
103+
104+
13. Set Height of Label Title4 to **45**.
105+
106+
14. Update FontSize of Label Subtitle4 to **18**.
107+
108+
15. Set Height of Label Subtitle4 to **45**.
109+
110+
16. Navigate to Items screen and copy the Back button from the top of the screen.
111+
112+
17. Go back to the New screen and paste the Back button copied in the previous step.
113+
114+
18. Now, navigate again to the Items screen and copy the label lblIndividualAreasHeader that reads the text as Location.
115+
116+
19. Go back to the New screen and paste the label copied in the previous step.
117+
118+
20. Set the following properties of the label
119+
- Y = **btnBackToHome\_1.Y+btnBackToHome_1.Height**
120+
121+
21. Set the following properties of the gallery StoresGallery
122+
123+
- Y = **btnBackToHome\_1.Height+lblIndividualAreasHeader_1.Height**
124+
125+
- Height = **Parent.Height-btnBackToHome\_1.Height- lblIndividualAreasHeader_1.Height**
126+
127+
- OnSelect = **Set(gblSelectedStore,ThisItem);Navigate('Items Screen')**
128+
129+
22. Navigate to the Items Screen and select the **Back to home** button on top.
130+
131+
23. Update the following properties of that button
132+
133+
- OnSelect = **Navigate(StoreSelectionScreen, ScreenTransition.Fade)**
134+
135+
- Text = **"Back to Store Selection"**
136+
137+
24. Navigate to Checklist Steps Screen.
138+
139+
25. Select the OnSelect property of the screen.
140+
141+
26. Update the Patch function for updating the Area Inspections app to add the Store value in the formula –
142+
143+
```
144+
, Store: gblSelectedStore
145+
```
146+
147+
148+
![Add Store to the Patch function](media/extend-inspections-add-hierarchy-to-locations/add-store-to-patch.png "Add Store to the Patch function")
149+
150+
### Update the Welcome Screen navigation
151+
152+
1. From the tree view, select the Welcome Screen.
153+
154+
2. Select the button Perform an Inspection (btnInspect).
155+
156+
3. Update the Navigate function from the OnSelect property of the button so that it navigates to the StoreSelectionScreen instead of the Items screen leaving the rest of the formula as is
157+
158+
```
159+
Navigate(
160+
161+
StoreSelectionScreen,
162+
163+
ScreenTransition.Fade
164+
165+
);
166+
```
167+
168+
![Navigate to Store Selection screen](media/extend-inspections-add-hierarchy-to-locations/code-to-navigate-to-store-selection-screen.png "Navigate to Store Selection screen")
169+
170+
### Publish the Inspections app
171+
172+
1. All the changes to the Inspection app are completed.
173+
174+
2. The app can now be published by selecting the Publish to Teams button on the top right.
175+
176+
![Publish to Teams](media/extend-inspections-add-hierarchy-to-locations/publish-to-teams.png "Publish to Teams")
177+
178+
## Edit the Review Inspections app
179+
180+
1. Login into Teams and right click Power Apps from the left menu and select **Pop out app**.
181+
182+
2. Select Build from the top ribbon.
183+
184+
3. Select the Team in which the Inspections app is installed.
185+
186+
4. Select Review Inspections to open the app in the editor.
187+
188+
5. The Review Inspections app opens.
189+
190+
6. Select **Data** from the left navigation menu.
191+
192+
7. Select **+Add** data and add the Stores table to this database for this app.
193+
194+
8. Also, refresh the Area Inspections table so that the Store column shows up in the table.
195+
196+
### Add a label to display the Store on the Inspection
197+
198+
1. Open the Tree view and select the Items Screen.
199+
200+
2. Under the Group grpInspectionSteps, there is a label called lblInspection\_SubmissionDetails.
201+
202+
3. Update the Text property of lblInspection_SubmissionDetails to the following
203+
204+
```
205+
If(
206+
207+
DateDiff(
208+
209+
Date(
210+
211+
Year(galInspections.Selected.createdon),
212+
213+
Month(galInspections.Selected.createdon),
214+
215+
Day(galInspections.Selected.createdon)
216+
217+
),
218+
219+
Today(),
220+
221+
Days
222+
223+
) = 0,
224+
225+
If(
226+
227+
DateDiff(
228+
229+
Date(
230+
231+
Year(galInspections.Selected.createdon),
232+
233+
Month(galInspections.Selected.createdon),
234+
235+
Day(galInspections.Selected.createdon)
236+
237+
),
238+
239+
Today(),
240+
241+
Hours
242+
243+
) \> 0,
244+
245+
galInspections.Selected.Store.Name & " \| Submitted by " &
246+
galInspections.Selected.createdby.'Full Name' & ", " & DateDiff(
247+
248+
Date(
249+
250+
Year(galInspections.Selected.createdon),
251+
252+
Month(galInspections.Selected.createdon),
253+
254+
Day(galInspections.Selected.createdon)
255+
256+
),
257+
258+
Today(),
259+
260+
Hours
261+
262+
) & " hrs ago",
263+
264+
If(
265+
266+
DateDiff(
267+
268+
Date(
269+
270+
Year(galInspections.Selected.createdon),
271+
272+
Month(galInspections.Selected.createdon),
273+
274+
Day(galInspections.Selected.createdon)
275+
276+
),
277+
278+
Today(),
279+
280+
Hours
281+
282+
) = 0,
283+
284+
//"minutes ago"
285+
286+
galInspections.Selected.Store.Name & " \| Submitted by " &
287+
galInspections.Selected.createdby.'Full Name' & ", minutes ago"
288+
289+
,
290+
291+
If(
292+
293+
DateDiff(
294+
295+
Date(
296+
297+
Year(galInspections.Selected.createdon),
298+
299+
Month(galInspections.Selected.createdon),
300+
301+
Day(galInspections.Selected.createdon)
302+
303+
),
304+
305+
Today(),
306+
307+
Days
308+
309+
) = 1,
310+
311+
//"yesterday",
312+
313+
galInspections.Selected.Store.Name & " \| Submitted by " &
314+
galInspections.Selected.createdby.'Full Name' & ", yesterday",
315+
316+
galInspections.Selected.Store.Name & " \| Submitted by " &
317+
galInspections.Selected.createdby.'Full Name' & ", " & DateDiff(
318+
319+
Date(
320+
321+
Year(galInspections.Selected.createdon),
322+
323+
Month(galInspections.Selected.createdon),
324+
325+
Day(galInspections.Selected.createdon)
326+
327+
),
328+
329+
Today(),
330+
331+
Days
332+
333+
) & " days ago"
334+
335+
)
336+
337+
)
338+
339+
)
340+
341+
)
342+
```
343+
344+
## Test the app
345+
346+
1. Open the Inspection App in the team in which it is installed.
347+
348+
2. The app loads.
349+
350+
3. Select the Welcome screen from the Tree view if running in the Editor and hit the Preview button to run the app.
351+
352+
4. Select the Perform an Inspection button.
353+
354+
5. Verify that the Store Selector screen opens.
355+
356+
6. Select a store.
357+
358+
7. The next screen should be the Items screen.
359+
360+
8. Select a ___location.
361+
362+
9. Select a food inspection checklist on the next screen.
363+
364+
10. Select the button **Begin Inspection**.
365+
366+
11. Answer the questions that are part of the inspection and hit the Review Inspection button at the bottom.
367+
368+
12. Select **Submit Inspection** on the next screen.
369+
370+
13. The Inspection is submitted.
371+
372+
14. Now, login into the Review Inspections app by selecting the Review Inspection tab on the top in the Team in which it is installed.
373+
374+
15. The app loads.
375+
376+
16. Select the ___location that you selected in step 8.
377+
378+
17. The list of inspections performed is displayed.
379+
380+
18. Select the Inspection that was submitted in step 13 above.
381+
382+
19. The screen displays the Store name before the Submitted by as shown in the screenshot below.
383+
384+
![Store showing on Location screen](media/extend-inspections-add-hierarchy-to-locations/test-result-store-on-___location-screen.png "Store showing on Location screen")
122 KB
Loading
Loading
4.73 KB
Loading
25.1 KB
Loading
Loading

0 commit comments

Comments
 (0)