Data Storage Buckets

Cyteis Help
 

Often you'd want to retrieve, store and query information. Not only may you want to source this data from the viewers but may also want to import your own data easily. You might also want to dynamically query this data into your web page and render the page differently, thereby creating basic web apps. Cyteis allows you to do all of this and this tutorial will cover the basics of this. The advanced tutorial covers querying the data dynamically and creating simple web apps.
 

Contents
  1. Adding a bucket
  2. Importing CSV data
  3. Integrating it within a page
  4. Browsing and searching the bucket
  5. Conclusion

Adding a bucket

Once you have logged in and created a site, from the Manage site page, please click on Add a Bucket. In this page, fill in the Bucket details:
  • Bucket Name: The name of the bucket. For this tutorial, we will be entering the name "subscribers".
  • Site page: The page that we want to associate the bucket with. For this tutorial, it is demo-data-bucket-basic page.
  • Visibility: The data in private buckets is protected and is not visible publically (e.g. on a webpage), whereas, public bucket's data can be queried publically. For this tutorial, we will continue with the Private bucket.

Please click on Add a data bucket. You can edit or delete this bucket from the Manage site page.

Importing CSV data

From the Manage site page, please click on Bulk upload file. From this page, you can import data in to the bucket. Please create a file subscribers.csv using a text editor (like Notepad) and enter the following text:
"name","jobtitle","email"
"Alex Bob","Chef","alex@sample1.com"
"Lisa James","Lawyer","lisa@james1.com"

Click on the Choose file button and browse to the subscribers.csv file and then click on Upload.


The page should reload with the message, "The data in the file has been uploaded successfully" and with the data loaded in the bucket table underneath.

Integrating it within a page

Please go to the page that you want to integrate the bucket with and click on Edit this Page. Next, please click on the Data Storage Form  and select the subscribers bucket and enter Subscribe as Button Text.

Please click on OK - you should see a form added to the editor. Please add three textboxes and give them the names: namejobtitle and email. For example:


Alternatively, you can embed the HTML code directly, which is otherwise automatically inserted by the Editor:
<form method="post" onsubmit="return addToStorage('Help/demo-data-bucket-basic', 'subscribers', this);">
Name: <input name="name" type="text" /><br />
Job title: <input name="jobtitle" type="text" /><br />
E-mail: <input name="email" type="text" /><br />
<input class="btnaddcart" type="submit" value="Subscribe" /></form>

As you might have realised, addToStorage is the function for adding contents to the bucket - it takes three arguments: the page of the bucket (in the format of {site}/{page}), the name of the bucket and the form object (usually this).

Please click on Save and Publish and go to the page. Enter an example data into the Subscribe form that we just created and click on Subscribe. Please click on the bucket from the Manage site page - you should see the entered subscription added to the data bucket results.

If you add another textfield, or indeed any other form control, you will notice the column added to the data bucket results table automatically.

Browsing and searching the bucket

As previously mentioned, you can browse the bucket by clicking on the bucket name from the Manage site page. You can query the bucket using the Search bucket functionality. For instance, if we want to find the records where the name field has "Alex Bob" or there is a mention of "lawyer" in the record, we can enter name:Alex Bob lawyer in the search box.


If you simply want to search within the table of records, you can enter the search text in the search bar above the table.

Conclusion

In this tutorial, we setup a data bucket, imported CSV data and integrated the data bucket with a web page. We also saw how to query the data from the bucket. The advanced version of this tutorial goes over how to dynamically query the bucket data from a web page and to change the content of the page based on the results.
 

Comments

salim kalladkkd 07/08/17:
tankeyuo