{"id":5533,"date":"2025-01-01T04:05:45","date_gmt":"2025-01-01T04:05:45","guid":{"rendered":"https:\/\/obsidiansofteducation.com\/?page_id=5533"},"modified":"2025-01-01T04:09:55","modified_gmt":"2025-01-01T04:09:55","slug":"customer-record-app-part-1","status":"publish","type":"page","link":"https:\/\/obsidiansofteducation.com\/index.php\/customer-record-app-part-1\/","title":{"rendered":"Customer Record App Part 1"},"content":{"rendered":"\n<p>Hello friends and welcome to Obsidian Soft,<\/p>\n\n\n\n<p>Today, I will show you how to make database app in MIT App Inventor in which we can keep data records such as customer records.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/snake20game209.png\" alt=\"\" style=\"width:645px;height:auto\"\/><\/figure>\n\n\n\n<p><a href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiwf7wZL9IthWOotGHpkQc9W_UScwB_Xsgt0TsTedCzAwPZf2QjUa5BQWyoBGDr_LPvQNUvvgFuQ_N_g3mZA2z9yfuKQmt_C1suPPoSWuhgqwse5mF6j8YeKYuV3Kvjpuxx0TRaome4p8JpcdYcwI3P-ug7ysahn3Tti5oQyukjf0mT6x9MI1x6invP\/s1280\/snake%20game%20(9).png\" target=\"_blank\" rel=\"noopener\"><\/a>We used the dictionary blocks when we made the GPT voice assistant app.&nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"978\" height=\"148\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image.png\" alt=\"\" class=\"wp-image-5535\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image.png 978w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-300x45.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-768x116.png 768w\" sizes=\"auto, (max-width: 978px) 100vw, 978px\" \/><\/figure>\n\n\n\n<p>However, I didn\u2019t go into the details of the dictionary block as I thought that it would make the video too complicated for my viewers.&nbsp;<\/p>\n\n\n\n<p>Today, I will explain the basic concept of a dictionary. In MIT App Inventor, a dictionary block is a way to store and organize data in pairs called &#8220;key-value&#8221; pairs.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"658\" height=\"144\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-1.png\" alt=\"\" class=\"wp-image-5536\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-1.png 658w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-1-300x66.png 300w\" sizes=\"auto, (max-width: 658px) 100vw, 658px\" \/><\/figure>\n\n\n\n<p>It&#8217;s similar to a real-life dictionary where you look up a word (key) to find its meaning (value).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"326\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-3.png\" alt=\"\" class=\"wp-image-5537\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-3.png 970w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-3-300x101.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-3-768x258.png 768w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/figure>\n\n\n\n<p>For example, let&#8217;s say we want to store information about a person, such as their name, phone number, and city. In a dictionary, we can assign a unique key to each piece of information. So, &#8220;name&#8221; can be the key to the person&#8217;s name, &#8220;phone number&#8221; can be the key to their phone number, and &#8220;city&#8221; can be the key to their city.&nbsp;<\/p>\n\n\n\n<p>Using a dictionary block, we can create this collection of information and associate each key with its corresponding value. We can access or modify specific values by referring to their keys.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"163\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-12-1024x163.png\" alt=\"\" class=\"wp-image-5550\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-12-1024x163.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-12-300x48.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-12-768x122.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-12.png 1448w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>And, we can even store this dictionary in a database such as TinyDB or cloudDB. So, you will also learn how to store multiple data or a record in the database in MIT App Inventor.<\/p>\n\n\n\n<p>Let\u2019s explain this concept practically using a very helpful app that you can use in your future projects. In our scenario, we have a departmental store and we want to store data about our regular customers so that we can tell them about deals and offers. Basically, we want to make a customer record system and the customer data will include the name and phone number; keeping things simple here.&nbsp;<\/p>\n\n\n\n<p>Open up MIT App Inventor and start a new project. Call it CustomerData.<\/p>\n\n\n\n<p>Drag and drop a vertical arrangement from the <strong>Layout<\/strong>.&nbsp; Rename it to mainScreenLayout. Make align horizontal and align vertical center. Make height and width both fill parent.&nbsp;<\/p>\n\n\n\n<p>Drag and drop a horizontal arrangement from the <strong>Layout<\/strong> and put it inside the mainScreenLayout. Make align horizontal and align vertical center. Make height 10&nbsp; percent and width fill parent.<\/p>\n\n\n\n<p>Drag and drop a label from the <strong>User Interface<\/strong> inside this horizontal arrangement. Rename it to nameLbl. Check <strong>FontBold<\/strong> and make&nbsp;<\/p>\n\n\n\n<p><strong>FontSize<\/strong>: 18<\/p>\n\n\n\n<p><strong>Width<\/strong>: 25%&nbsp;<\/p>\n\n\n\n<p><strong>Text<\/strong>: Name.&nbsp;<\/p>\n\n\n\n<p>Drag and drop a textBox from the <strong>User Interface. <\/strong>Rename it to nameTxt. Check FontBold and make&nbsp;<\/p>\n\n\n\n<p><strong>FontSize<\/strong>: 18<\/p>\n\n\n\n<p><strong>Width<\/strong>: 60%&nbsp;<\/p>\n\n\n\n<p><strong>Hint<\/strong>: Enter name<\/p>\n\n\n\n<p>Select the horizontal arrangement and duplicate it by pressing Ctrl + C and Ctrl + V on Windows OR Command + C and Command + V on MacBook.<\/p>\n\n\n\n<p>Rename the label to phoneLbl and make text: Phone No<\/p>\n\n\n\n<p>Rename the textBox to phoneTxt.<\/p>\n\n\n\n<p>Make the hint: Enter Phone No<\/p>\n\n\n\n<p>Check numbers only.<\/p>\n\n\n\n<p>Duplicate the horizontal arrangement again but remove the label and text from it. Drag and drop a button from the <strong>User<\/strong> <strong>Interface<\/strong> inside this empty horizontal arrangement. Rename it to addBtn. Optionally give it a black background color. Check FontBold and make<\/p>\n\n\n\n<p><strong>FontSize<\/strong>: 18<\/p>\n\n\n\n<p><strong>Width<\/strong>: 35%<\/p>\n\n\n\n<p><strong>Shape<\/strong>: Rounded<\/p>\n\n\n\n<p><strong>Text<\/strong>: Add<\/p>\n\n\n\n<p>And <strong>TextColor<\/strong>: White<\/p>\n\n\n\n<p>Duplicate this button and rename it to findBtn and make text: Find.<\/p>\n\n\n\n<p>Add a listView from the <strong>User Interface<\/strong> below the buttons arrangement. Make sure that it is also inside the mainScreenLayout. Make height 50%.<\/p>\n\n\n\n<p>Duplicate the buttons arrangement and put it below the listView. Rename addBtn to reloadBtn and change the text to Reload. Rename findBtn to deleteAllBtn and change the text to Delete All.<\/p>\n\n\n\n<p>Last but not least, drag and drop a TinyDB from <strong>Storage.<\/strong><\/p>\n\n\n\n<p>The screen design is done so let\u2019s work on the blocks section.<\/p>\n\n\n\n<p>Make a global variable for a record that is an empty dictionary and a global variable for a list of records that is an empty list.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"860\" height=\"198\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-2.png\" alt=\"\" class=\"wp-image-5538\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-2.png 860w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-2-300x69.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-2-768x177.png 768w\" sizes=\"auto, (max-width: 860px) 100vw, 860px\" \/><\/figure>\n\n\n\n<p>First, we will set our global record to a dictionary with appropriate key-value pairs.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"173\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-14-1024x173.png\" alt=\"\" class=\"wp-image-5552\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-14-1024x173.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-14-300x51.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-14-768x130.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-14-1536x260.png 1536w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-14.png 1574w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Then, we will add this record to the list of records<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"808\" height=\"142\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-4.png\" alt=\"\" class=\"wp-image-5539\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-4.png 808w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-4-300x53.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-4-768x135.png 768w\" sizes=\"auto, (max-width: 808px) 100vw, 808px\" \/><\/figure>\n\n\n\n<p>Then, we will store data in our tinyDB with the tag customerData.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"866\" height=\"208\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-5.png\" alt=\"\" class=\"wp-image-5540\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-5.png 866w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-5-300x72.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-5-768x184.png 768w\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" \/><\/figure>\n\n\n\n<p>Now, we need a procedure for showing this customer data in our listview so let\u2019s make it first. Go to procedures and get the first type of procedure and call it updateListView.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"575\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-15-1024x575.png\" alt=\"\" class=\"wp-image-5553\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-15-1024x575.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-15-300x168.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-15-768x431.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-15.png 1314w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>First , we will get a local variable from the variables section and make it an empty list. Inside it, we will put a loop that will go through all the records\/dictionaries inside our list of records and get all values for the different keys and use a join to make new items for our listForShowingData. At the end of the loop, we will give this new list to the listView\u2019s elements. Now, we need to call this updateListView procedure from our addBtn so call it at the end of addBtn.click event.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"368\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-16-1024x368.png\" alt=\"\" class=\"wp-image-5554\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-16-1024x368.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-16-300x108.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-16-768x276.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-16-1536x553.png 1536w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-16.png 1590w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now, we need to show existing data in our listview when the app is started so get screen1.initialize event and call tinyDB\u2019s getValue procedure with tag customerData and assign the result to the list of records variable and then, we call updateListView procedure.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"273\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-17-1024x273.png\" alt=\"\" class=\"wp-image-5555\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-17-1024x273.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-17-300x80.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-17-768x205.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-17.png 1320w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>When the user clicks the delete all button, we want to delete all customer records and also empty our listview.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"278\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-18.png\" alt=\"\" class=\"wp-image-5556\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-18.png 982w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-18-300x85.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-18-768x217.png 768w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/figure>\n\n\n\n<p>So, the basic app is done where we can add records with multiple data i.e. name and phone number using a dictionary and save it in our tinyDB. We can also load the current status of the DB when the screen is initialized and we can delete all records. I will cover search records by name and updating and deleting a single record in part 2 of this tutorial.<\/p>\n\n\n\n<p>If you like my tutorials, please consider supporting me:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><a href=\"https:\/\/obsidiansoft.gumroad.com\/l\/cxdft\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"196\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png\" alt=\"\" class=\"wp-image-5381\" style=\"width:233px;height:auto\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png 372w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1-300x158.png 300w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><strong><a href=\"https:\/\/obsidiansofteducation.com\/index.php\/customer-record-app-in-mit-app-inventor-database-records-part-2\/\">Part 2 Tutorial is now available<\/a>.<\/strong><\/p>\n\n\n\n<p>You can also download aia file for this project (part 1).<\/p>\n\n\n\n<p><strong><a href=\"https:\/\/drive.google.com\/file\/d\/1iS9o0xzbfLrT1wHL118Qb_xwZmVumufG\/view?usp=share_link\" target=\"_blank\" rel=\"noreferrer noopener\">Customer Record App Part 1<\/a><\/strong><\/p>\n\n\n\n<p>And, you can also have a look at the video tutorial here.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"Dictionary blocks in MIT App Inventor | Customer Record App | Storing records in MIT App Inventor\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/EVRoyvyloUU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p>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&#8217;t miss any of the great projects I have planned for you.&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/www.youtube.com\/c\/obsidiansofteducation\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/c\/obsidiansofteducation<\/a><\/p>\n\n\n\n<p>Please like my Facebook page and Instagram page for more educational resources and tips.<\/p>\n\n\n\n<p><strong>Facebook:<\/strong> <strong><a href=\"https:\/\/www.facebook.com\/ObsidianSoft\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.facebook.com\/ObsidianSoft\/<\/a><\/strong><\/p>\n\n\n\n<p><strong>Instagram:<\/strong> <a href=\"https:\/\/www.instagram.com\/obsidiansoftapps\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>https:\/\/www.instagram.com\/obsidiansoftapps\/<\/strong><\/a><\/p>\n\n\n\n<p><strong>Pinterest:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-pinterest wp-block-embed-pinterest\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"oceanwp-oembed-wrap clr\"><iframe loading=\"lazy\" title=\"Obsidian Soft\" src=\"https:\/\/assets.pinterest.com\/ext\/embed.html?grid=obsidiansoft&#038;src=oembed\" height=\"900\" width=\"450\" frameborder=\"0\" scrolling=\"no\" ><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<p>For links to free educational apps, have a look at the&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mobile-apps\/\" target=\"_blank\" rel=\"noreferrer noopener\">educational apps page<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends and welcome to Obsidian Soft, Today, I will show you how to make database app in MIT App Inventor in which we can keep data records such as customer records. We used the dictionary blocks when we made the GPT voice assistant app.&nbsp; However, I didn\u2019t go into the details of the dictionary [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5533","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/comments?post=5533"}],"version-history":[{"count":2,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5533\/revisions"}],"predecessor-version":[{"id":5569,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5533\/revisions\/5569"}],"wp:attachment":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/media?parent=5533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}