Buildfire: import existing database to dataStore and using it

402 Views Asked by At

I'm working in a Buildfire app, and, after reading the dataStore docs and trying the example codes in a the javascript tab in a custom plugin, I still have some questions:

  • How can I write field in the dataStore?
  • How can I import an existing csv database to the dataStore?
  • How can I connect these records to different apps?

thanks in advance

1

There are 1 best solutions below

2
On
  1. Writing to the Datastore is pretty simple. It is a NoSQL database that works somewhat like MongoDB. If you are unfamiliar with this type of database, at its core its a repository of JSON objects. Just assume a property in your document exists and so it does. There is no schema validation each document is its own entity. There are best practices of course. But the freedom is there to just start sending documents without identifying Tables and Columns ie a Schema

the official documentation can be found here

It is very important that you understand that the Datastore is behind BuildFire's CMS. Which means that it is read/write on the control side but read-only on the widget side. If you need to write on the widget side (mobile side) then you may want to consider using UserData or PublicData

  1. You can import a CSV file into Datastore using HTML5 fileReader (also a good read https://www.html5rocks.com/en/tutorials/file/dndfiles/) and Datastore Bulk Insert. You simply open the file, read line by line or use a CSV to JSON plugin to convert each line in your CSV file to a JSON object. Then use datastore builkInsert to push the records into Datastore

  2. How can you connect this data to multiple apps? You cannot. Since Datastore is a shared resource it is heavily segmented our so no data bleed may occur. That being said. If it is the same data copied over and over. You can have a local JSON file uploaded with your plugin and you can refer to that without the need for Datastore. However, If this is an absolute necessity you can either connect to your own custom DB using any web api. Or potentially use a solution like Googles Firebase that many of BuildFire Plugin developers enjoy using