Hello All

Today I'm going to continue to work on the layout of the app. I actually had the chance to enter a bit more data yesterday as I did a round of planting new herbs and flowers for my windows, since we're heading into the warmer months now here. I still need to create the basic layouts for the edit plant and edit species screens, which is what I'll work on today, then add the functionality to send watering/fertilising/etc. reminder notifications and finally clean up the app's look and add functionality like the ability to filter/sort/etc.

After doing some experimenting since the last post I have found that I can copy and paste the forms I already used for the add plant/species screens which will give me a lot of the fields I need to start with. To do this I went to the form component and copied it, then went to the first data card component within the canvas on my scrollable screen and pasted the form into there.

Animated gif showing the add plant form being copied from the add plant screen to the first data card in the edit plant screen

There's a few format changes I need to make after pasting the form in, primarily to set the form to edit mode rather than add mode for the selected plant. To do this I select the form and change the Default mode to Edit, then change the Item property of the form to be the selected item from the plant list gallery. I can then test this works by making sure the edit icon on the items in my gallery is set to select the parent before navigating to the edit screen and run the app to make sure the correct record appears in the edit screen.

Screenshot of edit screen showing changes to default mode and item properties

I then want to add another section that will hold additional information from the schedule and species tables. So, I click the Add section button and then expand the height of the new data card so I have a bit more room to work with, then start adding labels into the card which will contain the info.

Screenshot of edit plant screen with labels added in a new section to layout the additional data to come in from other tables

The next step is to get the actual data from the tables, for this I will use the LookUp function. The way this works is by taking the table we want to get the data from and then filtering it by a matching key in the current table. So for example the look up formula for the sun data is:

LookUp('Plant Species','Species Name' = PlantList_G_VPL.Selected.'Species ID').Sun

Where 'Plant Species' is the table which contains the Sun data, 'Species Name' is the unique ID in the Plant Species table for each record and PlantList_G_VPL.Selected.'Species ID' is getting the Species ID for the selected record from the Plant List screen which is the linking key between these tables, and finally .Sun is selecting the Sun data from the record the look up returns. Because I have named my schedule IDs based on how they occur rather than a purely numerical ID, I can simply use the schedule IDs from the species table rather than trying to call the schedule table via the species table, which would require a slightly more complicated look up formula.

I am also going to change the display settings on the Plant ID and Species ID fields since I want these fields to be viewable but not editable on this screen (a plant should not suddenly change species, right?) and change the height of the form so that the form doesn't scroll separately to the rest of the canvas by making it big enough to fit all the fields on it even though it goes outside the boundary of the screen. The final touches for the layout of this screen is to add buttons to be able to save the changes and to take the user back to the list screen. I decided to add these as icons at the top with both resetting the form once they have performed their other actions. Because these buttons sit outside of the canvas item they stay locked to the top of the screen when the user scrolls.

Animated gif showing that the buttons added outside of the canvas stay locked to the top of the screen when scrolling

With the edit plan screen done I'll build the edit species screen layout using similar steps for the relevant fields. While working on this I realised that the collections I set up to use for the schedules haven't run because I've only set them to run when clicking the button to go to the add screen which I haven't done and wouldn't necessarily do every session. To fix this I have moved the ClearCollect statements into the OnStart property of the app so they will initially load with the app. I can then right click on the App component and click Run OnStart to run the new OnStart formula.

Screenshot of the OnStart property of the app with the clear collect formulas set to run concurrently

I also ran into a problem with the water schedules and it using a multi-select in a column not built for it. As a result of this and other issues that have occurred in relation to this particular column I think I'm going to go back and change the way the database works to have it be a singular water schedule like the fertilise and prune schedules and get rid of the water changes column entirely, since so far I haven't been using it.

To make these changes to the database I first save all the changes I've made to my app and then go to the table in the dataverse. To remove the Water Changes column I can click on the ellipses on that column in the Columns tab and click Delete Column, then save using the button at the bottom of the screen. Then I need to update the data to ensure that every record only has a single water schedule with no semi-colon characters. The easiest way to complete this given the current small size of my database is to go to the Data tab, click on the Data menu at the top and select Edit data in Excel. This opens the table in excel, for it to work correctly you must enable the connection and login in the Data Connector tab using the same login you are using for Power Apps (note: this can be different to the overall login for Excel at the very top of the window). After making the changes to the relevant records I need to publish the changes using the Data Connector tab.

Screenshot of plant species table in excel with the publish link highlighted in the Data Connector tab

With this done, I now need to update both the add and edit screens for species in my app to remove the deleted column and turn off multi-select for the water schedule. I'll also change the update formula since it is no longer necessary to try and concatenate multi-selected items with semi-colons. Unfortunately it seems the changes I made to the table in terms of removing the water changes column has created an error in my app even though as far as I can tell that column is no longer being used anywhere in my app. I will need to investigate further to see if I can resolve this but I may need to remove the table everywhere it's used and re-add it... or maybe I could just re-add the unnecessary column to the table since it's not a required field it would just always be blank, not ideal but a solution.

For now I'm going to take a break and then do some more research, I'm still not able to get the current value for the water schedule to show up in the edit screen and I'm going to need to take a closer look at my data and how I'm joining it together to solve this.

Now for the real question, how many of the seeds I planted yesterday will I manage to successfully grow?