COVID19 Building Access App: Questions per Building

Part two of the Building Access App improvements article. This time I’m documenting steps to incorporate questions per building. With this new version you will not only be able to have different approvers per space but you will be able to configure different sets of questions per building.

You can use this version for scenarios where a specific building needs to have additional screening to make employees eligible to make reservations.

20200812_165218000_iOS20200812_165226000_iOS20200812_165239000_iOS20200812_165342000_iOS20200812_165349000_iOS

All the steps required to perform the required changes into the v1.1/v1.11 version are documented below. You can also access the modified package on GitHub using the link below:

https://github.com/cristianoag/BuildingAccess/releases/tag/v1.12

SharePoint

We will create two additional columns on the questions list stored SharePoint to create the relationship between buildings and questions. Additionally we will also create a column on the AppSettings list to store a flag that will control how if we will present questions per building or not.

  • Open SharePoint Online as administrator, access the site used to store data.
  • Include two additional columns (Building and Building:ID) in BAR_KeyQuestions.
    • Click Add Column, then select More…
    • In column name type Building. Select column type Lookup. Get information from the BAR_Buildings list and select Title from the “In this column” drop down. Select ID in “Add a column to show each of these additional fields”.
  • Include an additional Yes/No column (KeyQuestionsPerBuilding) in BAR_AppSettings. Select Yes/No Type. Default Value No.

Building Admin

The Building Admin app needs to be changed to include an additional configuration option to enable/disable the ability to present questions per building. We will also configure the forms to allow the relationship between buildings and questions.

  • Open PowerApps as administrator. Edit the Building Admin app.
  • Go to Data and refresh the BAR_KeyQuestions and BAR_AppSettings connections.
  • Go to Tree View and expand the Screen Key Questions Detail screen.
  • Click Edit fields and add the Building field.
  • Go to Tree View and expand the Screen App Settings screen. Select FormAppSettings. Click Edit fields and add the KeyQuestionsPerBuilding field.
  • Move the field up to be between Require Key Qestion completion before creating reservations and Key Questions failure message.
  • Select the field, select Advanced in properties. And Unlock it to change properties.
  • Change DisplayName to “Present Questions per Building”
  • Save and Publish the app

Building Access

Below are the steps to modify the Building Access app to change the screen flow. We need to perform those changes to ensure the building selection before present health questions. Users will need to pick a building so we can filter and present just questions for the specific building.

  • On Tree View, select App, go to OnStart event. Search for the colNav definition and change the first part of the JSON to navigate to the ScreenBuilding by default.

From:

Id: 0,
ScreenName: varString.NewRequest,
Description: varString.NewRequestDesc,
Screen: If(varAppSettings.KeyQuestions,’Screen Key Questions’ ,’Screen Building’),
Image: ic_fluent_building_24_regular

To:

Id: 0,
ScreenName: varString.NewRequest,
Description: varString.NewRequestDesc,
Screen: ‘Screen Building’,
Image: ic_fluent_building_24_regular
  • Expand Screen Building, select HeaderControlBuilding and change the NavigateScreen data field.

From:

If(varAppSettings.KeyQuestions,’Screen Key Questions’ ,’Screen Home’)

To:

‘Screen Home’
  • Still on Screen Building. Select ButtonCheckAvailability and change the OnSelect event to:
Set(varSelectedBuilding , First(colSelectedBuilding) );
If(varAppSettings.KeyQuestions,Navigate(‘Screen Key Questions’,ScreenTransition.None),
Navigate(‘Screen Availability’,ScreenTransition.None));
  • Expand Screen Key Questions, select ButtonSubmitKeyQuestions and change the OnSelect event as documented below.

From:

If( CountRows(Filter(colQuestionAnswersResponse,Answer =1)) >0, Set(varKeyQuestionsPass,false) , Set(varKeyQuestionsPass,true));
If(varKeyQuestionsPass,Navigate(‘Screen Building’),Navigate(‘Screen Key Question Confirmation’))

To:

If( CountRows(Filter(colQuestionAnswersResponse,Answer =1)) >0, Set(varKeyQuestionsPass,false) , Set(varKeyQuestionsPass,true));
If(varKeyQuestionsPass,Navigate(‘Screen Availability’),Navigate(‘Screen Key Question Confirmation’))
  • Still on Screen Key Questions, select the HeaderControl and change the NavigateScreen to:
If(varAppSettings.KeyQuestions,’Screen Key Questions’, ‘Screen Building’)
  • Click again in Screen Key Questions, on the OnVisible event, perform the changes below:

Replace:

If(IsEmpty(colKeyQuestions),ClearCollect(colKeyQuestions, Filter(BAR_KeyQuestions ,State.Value =”Published”)));

By:

If(varAppSettings.KeyQuestionsPerBuilding, ClearCollect(colKeyQuestions, Filter(BAR_KeyQuestions , State.Value =”Published” && Text(varSelectedBuilding.ID) = ‘Building:ID’.Value)), ClearCollect(colKeyQuestions, Filter(BAR_KeyQuestions ,State.Value =”Published”)));
  • Expand Screen Availability, change to the OnVisible event and paste the code below after the existent code:
Set(varBuildingControlsVisible,false);
// Get all floors/spaces for current buildind
ClearCollect(colFloors,Filter(BAR_Spaces,BuildingID = varSelectedBuilding.ID ));
Clear(colChosenRequests);
Set(varAvilabilityDatePickerDefault, Blank());
Set(varAvilabilityDatePickerDefault,Today());
Reset(DatePicker);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s