{"id":799,"date":"2023-02-17T13:39:42","date_gmt":"2023-02-17T05:39:42","guid":{"rendered":"https:\/\/five.co\/?p=799"},"modified":"2026-04-02T09:55:25","modified_gmt":"2026-04-02T01:55:25","slug":"building-an-application-that-interacts-with-the-google-maps-api","status":"publish","type":"post","link":"https:\/\/preview-php85.dzine.org\/five\/blog\/building-an-application-that-interacts-with-the-google-maps-api\/","title":{"rendered":"Building an Application That Interacts with the Google Maps API"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Five Lab: Building an Application That Interacts with the Google Maps API<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Welcome to Five Labs, a step-by-step guide to building applications using Five.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This lab guides you through creating a custom online database application that interacts with the Google Maps API. <a href=\"https:\/\/preview-php85.dzine.org\/five\/get-started\/\">Sign up<\/a>\u00a0now\u00a0and start building an application on\u00a0our low-code development environment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Lab Objectives &amp; Outcomes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By the end of this lab, you will have developed a custom online database application that<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Stores data that is retrieved from the Google Maps &amp; Google Places API in its own MySQL database,<\/li>\n\n\n\n<li>Gives end-users the ability to create, read, update, and delete the data stored inside your database, using a web GUI, and<\/li>\n\n\n\n<li>Gives end-users the ability to add additional data to their dataset.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The entire application is built inside of Five and contains:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Two tables in our custom-built MySQL database,<\/li>\n\n\n\n<li>One SQL query, and<\/li>\n\n\n\n<li>Three JavaScript functions.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">In total, we wrote 108 lines of custom code in SQL and JavaScript to build the entire application. Everything else that is required to build &amp; deploy the applications comes from inside Five.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img width=\"1280\" height=\"720\" src=\"https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Google-Maps-API-Application-Lines-of-Custom-Code.png\" alt=\"Five.Co - Google Maps API Application - Lines of Custom Code\" class=\"wp-image-805\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Keen to learn how? Keep on reading!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Application Requirements<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First up, let&#8217;s define our application requirements.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s say we are software engineers with a palate for the finer things in life: when we&#8217;re not programming, we enjoy good food and wine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We would now like to build our custom application that fetches all restaurants in a certain postcode and lets us add our custom reviews to each restaurant that we have visited.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The application is supposed to let us:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Search restaurants by postcode.<\/strong> We&#8217;d like to enter a postcode in a form field, and upon clicking a search button, the application is supposed to present us with a list of restaurants operating in the area. This data is supposed to be retrieved using the Google Maps API.<\/li>\n\n\n\n<li><strong>Select relevant restaurants from the search results.<\/strong> We would like to select those restaurants that sound interesting to us and store them permanently inside our MySQL database.<\/li>\n\n\n\n<li><strong>View all stored restaurants<\/strong>, as well as additional information about them, such as their opening hours retrieved from the Google Places API.<\/li>\n\n\n\n<li><strong>Add additional information about each restaurant<\/strong>, such as an ability to track if the restaurant has been visited before, and our verdict on their food.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">As a non-functional requirement, we would like the application to be a web application that runs in any browser and is responsive to screen size.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Steps To Develop The Application<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the steps required to build the application:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a <strong>new application<\/strong> inside Five,<\/li>\n\n\n\n<li>Define your <strong>MySQL database tables and fields<\/strong> inside Five,<\/li>\n\n\n\n<li>Add <strong>three JavaScript functions and a process<\/strong> to the application:\n<ol class=\"wp-block-list\">\n<li>The first JavaScript function <code>GetRestaurants<\/code> gets restaurants by postcode from the Google Maps API,<\/li>\n\n\n\n<li>The second JavaScript function&nbsp;<code>SaveRestaurants<\/code> lets us fetch additional data about each restaurant, such as the opening hours from the Google Places API, and insert their data into our database,<\/li>\n\n\n\n<li>The third JavaScript function <code>SaveRestaurantButton<\/code> is a client-side function to the call server-side function described in 2.<\/li>\n\n\n\n<li>We also need one process to associate the <code>GetRestaurants<\/code> function with a DoRun event in our end-user application.<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Write a SQL query <code>SelectRestaurants<\/code> to display all saved restaurants in a report.<\/li>\n\n\n\n<li>Create a form and a dashboard for your end-users to view and edit saved restaurants.<\/li>\n\n\n\n<li>Last, we will launch the application to see what it looks like.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s go through each step with code samples one by one.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Step 1: Creating a New Application Inside Five<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Launch Five, and <a href=\"https:\/\/help.five.org\/docs\/applications\/create-an-application\" rel=\"nofollow noopener\" target=\"_blank\">click the yellow + button to create a new application<\/a>. Give it any name and click save. Don&#8217;t worry about any of the other application settings. Next click on Manage to start developing your application.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img width=\"1280\" height=\"720\" src=\"https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/01\/Five.Co-Manage-Your-Application.png\" alt=\"Five.Co - Manage Your Application\" class=\"wp-image-741\"\/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2: Define Your MySQL Database Tables and Fields<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The next step in building an application is to define our MySQL database tables and fields. Our application has a total of two tables:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The first table is named <code>Restaurants<\/code> and temporarily stores all restaurants that we retrieve from the Google Maps API.<\/li>\n\n\n\n<li>The second table is named <code>SavedRestaurants<\/code>, and permanently stores all restaurants that we wish to add to our database.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Five comes with a handy table wizard that makes creating database tables a breeze. Simply follow our <a href=\"https:\/\/help.five.org\/docs\/tables\/table-wizard\/graphical-user-interface\" rel=\"nofollow noopener\" target=\"_blank\">Table Wizard documentation<\/a> to create the tables required for this application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is how each table should look once you have created them from inside Five.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img width=\"1280\" height=\"720\" src=\"https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Google-Maps-API-Application-Database-Tables.png\" alt=\"Five.Co - Google Maps API Application - Database Tables\" class=\"wp-image-801\"\/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3: Writing JavaScript Functions Inside of Five<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let&#8217;s work on the most important part of the application: the functions that help us retrieve the data from the Google Maps API. Click on Functions, and then on the Plus button to add a new function. We have added comments to each function below to explain their workings. You can delete those comments if you do not require them.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img width=\"1280\" height=\"720\" src=\"https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Google-Maps-API-Application-Functions.png\" alt=\"Five.Co - Google Maps API Application - Functions\" class=\"wp-image-803\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">The GetRestaurant Function<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">When you interact with an API, you typically make&nbsp;<code>GET<\/code> requests to retrieve data from web servers. So let&#8217;s start with the <code>GetRestaurant<\/code> JavaScript function. Remember this function is designed to retrieve information from the Google Maps API, so you will also need to have an API key to make this function work properly.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"function GetRestaurants(five, context, result)  {\n    const API_KEY = 'Insert Your API Key Here';\n    \/\/ Getting the PostCode by the user else keep the default Values as 4000\n    const POST_CODE = context.PostCode ? context.PostCode : '4000'\n    \/\/URL for our API \u2b07\ufe0f\n    const url = `https:\/\/maps.googleapis.com\/maps\/api\/place\/textsearch\/json?query=restaurants%20in%20${POST_CODE}%20QLD&amp;key=${API_KEY}`;\n    \/\/ Setting Up Our httpClient and sending a get request to places API\n    const client = five.httpClient();\n    let httpResult = client.get(url);\n    if (httpResult.isOk() === false) {\n      return five.createError(httpResult);\n    }\n    let sql; \/\/ SQL query\n    let queryResults; \/\/ result for the query\n    let place_id; \/\/ place id for each restaurant\n    let guid; \/\/ GUID for the primary key for our table\n    \/\/ Delete Data from the table as we repopulate with every call\n    sql = 'DELETE FROM Restaurants'\n    queryResults = five.executeQuery(sql, 0);\n    \/\/ mapping through each restaurant from the API\n    httpResult.response.results.map(item =&gt; {\n      \/\/ getting the id and generating GUID\n      place_id = item.place_id;\n      guid = five.uuid();\n      \/\/ inserting values into the table\n      sql = `INSERT INTO Restaurants (RestaurantsKey,PlaceID,name, address,status) VALUES (?,?,?,?, 'Not Saved')`\n      queryResults = five.executeQuery(sql, 0, guid, place_id,item.name,item.formatted_address);\n      if(!queryResults.isOk()){\n        return five.createError(queryResults);\n      }\n    })\n    return five.success(result);\n}\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">function<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">GetRestaurants<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">API_KEY<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Insert Your API Key Here<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/ Getting the PostCode by the user else keep the default Values as 4000<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">POST_CODE<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">PostCode<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">?<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">PostCode<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">4000<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/URL for our API \u2b07\ufe0f<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">url<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #A3BE8C\">https:\/\/maps.googleapis.com\/maps\/api\/place\/textsearch\/json?query=restaurants%20in%20<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">POST_CODE<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">%20QLD&amp;key=<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">API_KEY<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/ Setting Up Our httpClient and sending a get request to places API<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">client<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">httpClient<\/span><span style=\"color: #D8DEE9FF\">()<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">httpResult<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">client<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">get<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">url<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">httpResult<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isOk<\/span><span style=\"color: #D8DEE9FF\">() <\/span><span style=\"color: #81A1C1\">===<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">false<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">createError<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">httpResult<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">sql<\/span><span style=\"color: #81A1C1\">;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\">\/\/ SQL query<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #81A1C1\">;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\">\/\/ result for the query<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">place_id<\/span><span style=\"color: #81A1C1\">;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\">\/\/ place id for each restaurant<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">guid<\/span><span style=\"color: #81A1C1\">;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\">\/\/ GUID for the primary key for our table<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/ Delete Data from the table as we repopulate with every call<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">sql<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">DELETE FROM Restaurants<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">executeQuery<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">sql<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/ mapping through each restaurant from the API<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">httpResult<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">results<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">map<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">item<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">      <\/span><span style=\"color: #616E88\">\/\/ getting the id and generating GUID<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #D8DEE9\">place_id<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">item<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">place_id<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #D8DEE9\">guid<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">uuid<\/span><span style=\"color: #D8DEE9FF\">()<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">      <\/span><span style=\"color: #616E88\">\/\/ inserting values into the table<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #D8DEE9\">sql<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #A3BE8C\">INSERT INTO Restaurants (RestaurantsKey,PlaceID,name, address,status) VALUES (?,?,?,?, &#39;Not Saved&#39;)<\/span><span style=\"color: #ECEFF4\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">executeQuery<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">sql<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">guid<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">place_id<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9\">item<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">name<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9\">item<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">formatted_address<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #81A1C1\">!<\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isOk<\/span><span style=\"color: #D8DEE9FF\">())<\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">createError<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">success<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When reading through the function above, you might be wondering why our&nbsp;<code>INSERT INTO<\/code>&nbsp;statement contains four question marks&nbsp;<code>?,?,?,?<\/code>&nbsp;for its values. Inside Five, question marks are used&nbsp;as placeholders for the values from the variable in a&nbsp;<code>INSERT INTO<\/code>&nbsp;statement.&nbsp;<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">The SaveRestaurants Function<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Next up, is the&nbsp;<code>SaveRestaurants<\/code>&nbsp;JavaScript function. Remember this function is designed to fetch additional data about each restaurant, such as the opening hours from the Google Places API, and inserts their data into our database.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"function SaveRestaurants(five, context, result)  {\n    const API_KEY = 'Insert Your API Key Here';\n    \/\/ getting the place_ID for the place details API to get details of a restaurant\n    const place_id = context.PlaceID\n    five.log(JSON.stringify(context))\n    const API_URL = `https:\/\/maps.googleapis.com\/maps\/api\/place\/details\/json?place_id=${place_id}&amp;key=${API_KEY}`\n    const client = five.httpClient();\n    let httpResult = client.get(API_URL);\n    \/\/ getting the opening hours\n    const hours = httpResult.response.result.current_opening_hours ? httpResult.response.result.current_opening_hours.weekday_text.toString() : 'Opening Hours Not Defined'\n    const openingHours = hours.split(',').join('\\n')\n    \/\/ getting the phone number\n    const phoneNumber = httpResult.response.result.formatted_phone_number ? httpResult.response.result.formatted_phone_number : 'Phone Number Not Defined'\n     let guid = five.uuid();\n    \/\/ saving data into SavedRestaurants Table\n    let sql = `INSERT INTO SavedRestaurants (SavedRestaurantsKey,Name, Address,PhoneNumber,OpeningHours) VALUES ('${guid}','${context.Name}','${context.Address}', '${phoneNumber}', '${openingHours}')`\n    let queryResults = five.executeQuery(sql, 0);\n    if(!queryResults.isOk()) {\n        return five.createError(queryResults);\n    }\n    \/\/ updating the status in Restaurants to Saved\n    sql = `Update Restaurants SET Status = 'Saved' Where RestaurantsKey = ?`\n    queryResults = five.executeQuery(sql, 0, context.RestaurantsKey);\n    if(!queryResults.isOk()) {\n        return five.createError(queryResults);\n    }\n    five.commit()\n    return five.success(result);\n}\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">function<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">SaveRestaurants<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">API_KEY<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Insert Your API Key Here<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/ getting the place_ID for the place details API to get details of a restaurant<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">place_id<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">PlaceID<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">log<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">JSON<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">stringify<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #D8DEE9FF\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">API_URL<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #A3BE8C\">https:\/\/maps.googleapis.com\/maps\/api\/place\/details\/json?place_id=<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">place_id<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">&amp;key=<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">API_KEY<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #ECEFF4\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">client<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">httpClient<\/span><span style=\"color: #D8DEE9FF\">()<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">httpResult<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">client<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">get<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">API_URL<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/ getting the opening hours<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">hours<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">httpResult<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">current_opening_hours<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">?<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">httpResult<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">current_opening_hours<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">weekday_text<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">toString<\/span><span style=\"color: #D8DEE9FF\">() <\/span><span style=\"color: #81A1C1\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Opening Hours Not Defined<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">openingHours<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">hours<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">split<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">,<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">join<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #EBCB8B\">\\n<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/ getting the phone number<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">phoneNumber<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">httpResult<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">formatted_phone_number<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">?<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">httpResult<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">formatted_phone_number<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Phone Number Not Defined<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">     <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">guid<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">uuid<\/span><span style=\"color: #D8DEE9FF\">()<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/ saving data into SavedRestaurants Table<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">sql<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #A3BE8C\">INSERT INTO SavedRestaurants (SavedRestaurantsKey,Name, Address,PhoneNumber,OpeningHours) VALUES (&#39;<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">guid<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">&#39;,&#39;<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">Name<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">&#39;,&#39;<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">Address<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">&#39;, &#39;<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">phoneNumber<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">&#39;, &#39;<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">openingHours<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">&#39;)<\/span><span style=\"color: #ECEFF4\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">executeQuery<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">sql<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #81A1C1\">!<\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isOk<\/span><span style=\"color: #D8DEE9FF\">()) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">createError<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/ updating the status in Restaurants to Saved<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">sql<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #A3BE8C\">Update Restaurants SET Status = &#39;Saved&#39; Where RestaurantsKey = ?<\/span><span style=\"color: #ECEFF4\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">executeQuery<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">sql<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">RestaurantsKey<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #81A1C1\">!<\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isOk<\/span><span style=\"color: #D8DEE9FF\">()) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">createError<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">queryResults<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">commit<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">success<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">The SaveRestaurantsButton Function<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Last is the&nbsp;<code>SaveRestaurantsButton<\/code>&nbsp;JavaScript function. Remember this function is a client-side function to the call server-side&nbsp;<code>SaveRestaurants<\/code>&nbsp;function.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img width=\"1280\" height=\"720\" src=\"https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Google-Maps-API-Application-JavaScript.png\" alt=\"Five.Co - Google Maps API Application - JavaScript\" class=\"wp-image-804\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"\/**\n *\n * Using the Client Side Function to call server side function : SaveRestaurants\n *\n *\/\nfunction SaveRestaurantsButton(sender, context, result)  {\n    let variables = Object.assign({}, form.field);\n    const functionName = 'SaveRestaurants';\n    var _five = five; \/\/ need to preserve five as returning will null this object.\n    five.executeFunction(functionName, variables, null, null, null, function (result) {\n    });\n    return five.success(result);\n}\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #616E88\">\/**<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"> *<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"> * Using the Client Side Function to call server side function : SaveRestaurants<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"> *<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"> *\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">function<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">SaveRestaurantsButton<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">sender<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">context<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">let<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">variables<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">Object<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">assign<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">{},<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">form<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">field<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">functionName<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">SaveRestaurants<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">var<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">_five<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #81A1C1\">;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\">\/\/ need to preserve five as returning will null this object.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">executeFunction<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">functionName<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">variables<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">null<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">null<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">null<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">function<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">five<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">success<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">result<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">The DoRun Event<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">We also need one process to associate the&nbsp;<code>GetRestaurants<\/code>&nbsp;function with a DoRun event in our end-user application. Why? Because we want this function to run upon the click of a button. This is called a process inside of Five.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click on Processes in the left-hand menu, and create a new process. Click on events, and select the&nbsp;<code>GetRestaurants<\/code>&nbsp;function in the Do Run drop-down box. Your process should look like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img width=\"1280\" height=\"720\" src=\"https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Google-Maps-API-Application-Process-and-Do-Run.png\" alt=\"Five.Co - Google Maps API Application - Process and Do Run\" class=\"wp-image-806\"\/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Step 4: Write a SQL Query Inside of Five<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Our final application is supposed to display all restaurants we\u2019ve visited inside a query. To achieve this, we will write a short SQL query called&nbsp;<code>Restaurant Report<\/code>. Click on Queries, and create a new query that looks like this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"Select\n    RestaurantsKey,PlaceID,Name,Address, PhoneNumber,\n    'Save Details'as'Save Details'\nfrom Restaurants\n    Where Status = 'Not Saved'\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">Select<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    RestaurantsKey,PlaceID,<\/span><span style=\"color: #81A1C1\">Name<\/span><span style=\"color: #D8DEE9FF\">,<\/span><span style=\"color: #81A1C1\">Address<\/span><span style=\"color: #D8DEE9FF\">, PhoneNumber,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Save Details<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #81A1C1\">as<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Save Details<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">from<\/span><span style=\"color: #D8DEE9FF\"> Restaurants<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">Where<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">Status<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Not Saved<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Step 5: Creating The Form &amp; Dashboard<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let\u2019s create a form for your end-users to see all saved restaurants. To do so, you can use Five\u2019s Form Wizard and select the&nbsp;<code>SavedRestaurants<\/code>&nbsp;table. Five will automatically fill in all required information for creating the form for you, so&nbsp;<a href=\"https:\/\/www.youtube.com\/watch?v=gvYtICGa-H0\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">all you need to do is follow the steps of the wizard<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Last, we\u2019d like to add a dashboard to our end-user application. The dashboard will let us enter a postcode, and display the results from our&nbsp;<code>GetRestaurants<\/code>&nbsp;function below it. It will look as shown on the image below.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To do this, click on Dashboards in the menu on the left, and create a new dashboard. Give it any name, and a 1-column and 5-row grid. You can define these two parameters when you set up the dashboard. Next, click on Actions, and put&nbsp;<code>GetPostcode<\/code>&nbsp;into cell A1, and the&nbsp;<code>Restaurant Report<\/code>&nbsp;into cell A2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s what this will look like in the finished application:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img width=\"1280\" height=\"720\" src=\"https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Google-Maps-API-Application-Finished-Application.png\" alt=\"Five.Co - Google Maps API Application - Finished Application\" class=\"wp-image-802\"\/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Step 6: Launch the Application<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Up until now, all we have been doing is building the application. Now it\u2019s time to preview what we\u2019ve built.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are working on Five\u2019s free download, click the play \u25b6\ufe0f button in the top right corner, shown below. If you are developing your application on the cloud, look for the Deploy to Development button, in the same location. This will launch the application into its dedicated development environment, and gives you an opportunity to preview the application before shipping it to production.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img width=\"1280\" height=\"720\" src=\"https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Run-Your-Application.png\" alt=\"Five.Co - Run Your Application\" class=\"wp-image-828\"\/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">And that&#8217;s it. You&#8217;ve finished building an application that retrieves restaurant information and stores them inside your own MySQL database! In this tutorial, you have used several of Five&#8217;s features: from creating and managing your own MySQL database to writing JavaScript functions and using <code>Get<\/code> requests to fetch information based on your search parameters. You have also created forms and dashboards for your end-users to interact with your data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you have any other questions or would like to learn more about building applications using Five, visit our <a href=\"https:\/\/five.org\" rel=\"nofollow noopener\" target=\"_blank\">user community to learn from other users or to get answers to your questions<\/a>!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/preview-php85.dzine.org\/five\/get-started\/\">Sign up<\/a>\u00a0now\u00a0and start developing on\u00a0our low-code development environment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Five Lab: Building an Application That Interacts with the Google Maps API Welcome to Five Labs, a step-by-step guide to building applications using Five. This lab guides you through creating a custom online database application that interacts with the Google Maps API. Sign up\u00a0now\u00a0and start building an application on\u00a0our low-code development environment. Lab Objectives &amp; [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":800,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_eb_attr":"","_uag_custom_page_level_css":"","footnotes":""},"categories":[21],"tags":[],"class_list":["post-799","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"uagb_featured_image_src":{"full":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Building-An-Application-That-Interacts-with-the-Google-Maps-API.png",1280,720,false],"thumbnail":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Building-An-Application-That-Interacts-with-the-Google-Maps-API.png",150,84,false],"medium":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Building-An-Application-That-Interacts-with-the-Google-Maps-API.png",300,169,false],"medium_large":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Building-An-Application-That-Interacts-with-the-Google-Maps-API.png",768,432,false],"large":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Building-An-Application-That-Interacts-with-the-Google-Maps-API.png",1024,576,false],"1536x1536":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Building-An-Application-That-Interacts-with-the-Google-Maps-API.png",1280,720,false],"2048x2048":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2023\/02\/Five.Co-Building-An-Application-That-Interacts-with-the-Google-Maps-API.png",1280,720,false]},"uagb_author_info":{"display_name":"Dominik Keller","author_link":"https:\/\/preview-php85.dzine.org\/five\/author\/f1v5_ed3_my\/"},"uagb_comment_info":0,"uagb_excerpt":"Five Lab: Building an Application That Interacts with the Google Maps API Welcome to Five Labs, a step-by-step guide to building applications using Five. This lab guides you through creating a custom online database application that interacts with the Google Maps API. Sign up\u00a0now\u00a0and start building an application on\u00a0our low-code development environment. Lab Objectives &amp;&hellip;","_links":{"self":[{"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/posts\/799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/comments?post=799"}],"version-history":[{"count":3,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/posts\/799\/revisions"}],"predecessor-version":[{"id":17432,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/posts\/799\/revisions\/17432"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/media\/800"}],"wp:attachment":[{"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/media?parent=799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/categories?post=799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/tags?post=799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}