Google apps script CAN'T store attachment addons - javascript

I would like to know how to store something when you use check box and later access it when checkbox state changes.
I tried store array as global but when script runs again what i stored is reseted to empty array.
I also tried propeties but it can only store strings.
So if anybody know how to store attachments i would be glad.

There are lots of ways on how this can be approached. Either you can store data to a spreadsheet and build scripts based on the Google Sheet Data by referring to this document.
If it's a file were talking about you can use DriveApp using the method createFile() from a given Blob of arbitrary data. Documentation here.
Or, you can connect to an external database using JDBC Service as reference here in this documentation.

Related

I can recover original data after modifying it with ".update" in Firebase Cloud Firestore?

I am using the Firebase Cloud Firestore database with JavaScript and Node.js.
I accidentally modified a document inside collection that contained very important data.
I did this using the .update method as explained in the Update a document section of the official Firebase documentation.
The point is that since I was using test data, when modifying the document I did not update its data correctly, but rather I overwritten the original information with the test data.
Since I didn't do any kind of backup of that data, my question is ...
Is there a way to get back the original data that I overwritten using the '.update'?
Firestore does not automatically keep back ups of your data, so unless you set up an automatic export of the data yourself the previous contents of the document are lost.
If this is business critical data, you could try reaching out to Firebase support for personalized help in troubleshooting. But since you said it's test data, the better path is likely to figure out how to set up your test data automatically in a way that makes it reproducible in case of a coding mistake like this one.

Full CRUD app without a database possible?

If I use a json file stored in one of my GitHub repos as a mock backend, I know how to fetch and read all the data. Is it also possible to edit or post new data to this json file? Would an alternative mock backend like Mocky.io be a better solution (to achieve full CRUD)?
I think you could store the information inside csv files or somehting like that, you would be recreating a database engine as MongoDB & create your own reader to find the info, or you could store the users info using local Storage,
However this would make your app very limited.
Here's the link for the documentation of local storage
https://developer.mozilla.org/es/docs/Web/API/Window/localStorage
Well if you want to try out CRUD operations you can use free JSON APIs like http://jsonplaceholder.typicode.com/ or
https://mockfirst.com/
where you can create, read, update and delete data using various api end points. It is better to go this way first then you could move on to updating a JSON file.
(UPDATE)
You can use https://jsonbin.io/
Here you can place your own data and use it as an API.

Issue in Fetching the Data from Apache Ignite using Node Express

I am new to Apache Ignite.Can someone help me on how to fetch and load the data from ignite cache
using node js without using sql field queries option. Cache is loaded using CacheJDBCPOJO Store and the Key and Value types are custom types defined using JAVA.As these classes are defined in Java not sure on how to fetch the data using node.
Hope the following example , explains the issue better.
We have ignite cache of custom key Type i.e Person Key with attributes Person First Name and person Last Name and custom value type i.e Person Info with attributes Person Address and Person Age etc.
These classes are defined in Java and the caches are configured in Bean File and loaded using CacheJDBCPOJO Store.
As these classes will not be available in node js, how can we load /fetch the data from node js using cahe.put /cache.get.Tried creating similar classes in node and pass the object of these classes to
cahe.put /cache.get but it is in't working.
I can see the following error:
ERROR: Binary type has different field types [typeName=OrderId, fieldName=OrderID, fieldTypeName1=long, fieldTypeName2=double] (node:13596)
Which will probably be fixed by removing ignite work dir (/tmp/ignite/work or ./ignite/work by default) and restarting all your nodes, and as such, not related directly to node.js
As for examples, have you tried the following:
https://apacheignite.readme.io/docs/nodejs-thin-client-binary-types
As for REST API, it should convert BinaryObject's to JSON by default, this should include all SQL columns' values.
Update: Turns out you have to do query.setIncludeFieldNames(true) to make getFieldNames() return field names.

SpagoBI data set: use javascript to access to MongoDB data base

Since data set in SpagoBI could be created using scripts, I need to connect, query my MongoDB data base using javascript (or Groovy).
I need to use scripts to be able to execute aggregation on the mongoDB data, I can't use aggregation directly on my MongoDB because my data type is String
I dont know how to access my Database using scripts
Any ideas?
You should create a Mongo dataset. The steps to create are:
Step1: Create a Mongo datasource in the administrator console. Notes: the type must be JDBC and the value for Class input field must be "mongo"
JDBC: {unit_host}:{port}/${db}
CLASS: mongo
Step2: now you can create a dataset. The procedure is the same of the query datasets. The difference here is the language.. JS instead of SQL.
Take a look at the SpagoBI wiki in particolar here: http://wiki.spagobi.org/xwiki/bin/view/spagobi_server/data_set#HQueryDataSet28Mongo29
When connecting to mongoDB, you pass auth stuff in the url. Since the scripts lies on the client side, it would be hard to make the connection secure (unless you are talking about backend JavaScript). Anybody would be able to see how to connect to your DB and for instance delete all content.
I would suggest a simple api to interface the database. Then u control the access to what a user can do towards the database.
Or have I misunderstood the scenario?

Live updating from JSON

I have a JSON file which is dynamically and contain match info including an unique id. The JSON is divided into 3 arrays live, upcoming and recent. Since i'm quite new to Javascript i'm wondering what would be the best way to go in order to make this livescore script. I need it to be updating without refreshing browser? What is my options? Maybe someone has a snippet?
The JSON is automatically updates through another script which is connected to a cron job, so the script does not need to do anything regarding the JSON. Only retrieve and show the data.
I'm using dreamhost, which gives me access to shell, so websockets and so on is an option.
You'll need a jquery user to give you a snippit for this one, but in vanilla ecmascript 6, you use an XMLHttpRequest object to get the JSON from your server. This object can request data from the server asynchronously and is triggered by the client/browser so you can update the live match info when and as often as you like. You would just have to write a function to replace the data on the webpage with the new info when it is updated.

Categories

Resources