Client Record App part 2

 Hello friends and welcome to Obsidian Soft,


This is part 2 of the Client/Customer Record App tutorial.

Part 1 written tutorial here

Go to Designer View and duplicate the mainScreenLayout. (Select it first and press Ctrl + C and Ctrl + V for Windows or Command + C and Command + V for MacOS) Rename it to UpdateScreenLayout and delete the list view and the horizontal layout with reload and delete all buttons from it. Rename addBtn2 to saveBtn and change the text to Save. Rename findBtn2 to deleteBtn and change the text to Delete.

Now, make this UpdateScreenLayout invisible by unchecking visible. 

Go to the block section.

Add another global variable for the selectedRecordIndex when the user touches an item on the listview.

We are using the concept of virtual screens here i.e. two full-screen layouts out of which only one is visible at one time. When the screen is initialized, we want to make sure that only our mainscreenlayout is showing. So, add the following code to screen1.initialize event.

Next, we will show the updateScreenlayout when the user taps on a record on the listview with the filled-in values of the record on which the user had tapped.

Now, the user can either make some changes and press save or he can delete the entire record.

If he presses save, the code is similar to addBtn code. We make a dictionary and set it to global record but this time, we replace it in the list for the chosen index. In the end, we also set selectedindex back to 0. Why? You will know the reason soon.

Now, empty the delete button code as it was duplicated from findBtn and put code in it for removing the item from the list for the selectedRecordIndex and storing the list in tinyDB, and updating listview by calling custom procedure and making our update screen invisible. In the end, again make selectedRecordIndex 0.

Now what happens when the user presses the find button? We will assume that he has provided a name before pressing find. Again, you need to add error checks when you are making a  professional app.

We will make a local variable list just like we made in updatelistview procedure but this time we will search in our list of records for the name provided by the user using a for loop where we can know the number i.e. index at which the record is found. We need this while updating the main Record list if the user decides to edit or delete this record by tapping on it.

In the end, update listview with this local variable foundList.


Now, we need to make a slight change in our listview’s after-picking event if the picking event happens after the user has looked for a particular customer by pressing the find button then we need to use that index of the found item otherwise just the listview’s selection index.  This is why we were making the selectedRecordIndex back to  0 at the end of save and delete to differentiate between update after finding the record and update after selecting a record from the entire list.


At any time, we want to again look at our entire customer records list, we can press reload button which will just

call updateListView procedure.


You can also download aia file for this project.

Customer Record App Part 2


And, you can also have a look at the video tutorial here.



Please like my video and share it with your friends and family. Also, subscribe to my channel and press the bell icon so you don't miss any of the great projects I have planned for you. 

https://www.youtube.com/c/obsidiansofteducation


Please like my Facebook page and Instagram page for more educational resources and tips.
Pinterest:
https://www.pinterest.co.uk/obsidiansoft/_created/
For links to free educational apps, have a look at the educational apps page
Subscribe to my YouTube Channel for educational videos for coding, mental maths, app development, and phonics: 


Comments

Popular posts from this blog

Jolly Phonics Group 1

Jolly Phonics Group 2

Jolly Phonics Flash Cards