Coding the blocks – receiving data

The previous blocks request in data from the Fusion Table, now we need to code receiving the information from the Fusion Table. The when FusiontablesControl1.GotResult block does this. You will find it in the FusiontablesControl1 blocks. As we mentioned before, when data from Fusion Tables is received, this event gets triggered. The data is placed in the result variable of this event.

By default, the data we receive from the Fusion Table is a block of text with each row placed on its own line. This data also includes the column header. So, let's say the Guest Names column of our Fusion Table has three rows with the names Olivienne, Dash, and Eva. Then the data that is placed in the result variable has four lines—Guest Names, Olivienne, Dash, and Eva (the column header followed by the three names).

Since we want the when FusiontablesControl1.GotResult event to automatically display the guest names (and the header), select and connect the set GuestListLabel.Text to block. What do we want it to display? The result variable. Hover your cursor over the light orange result variable embedded in the gold event block. A pop-up with two orange blocks will appear, as shown in the following screenshot. Select the get result block and attach it to the open socket in the GuestListLabel.Text block:

Coding the blocks – receiving data

That's it! Now your GuestList_Screen will display all the guests who have RSVP'ed. The following screenshot shows the completed sets of blocks:

Coding the blocks – receiving data

It is time to try your app! Fill out the RSVP form to see if it populates into your Fusion Table. Does the app then clear the RSVP screen fields and display the names in the Guest List screen?

If you recall, we set up our app to gather other data from the RSVP besides the list of guest names. We created fields so guests could input the number of people they are bringing and the food/drink item to share. You could also display this information for other guests to see, but really that data is for the host, who can easily view it along with the names in the Fusion Table columns we created.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset