Hello Peter,
You don't mention the error that you get... even in the AB debugger: because we are talking about a syntax error. The problem is caused by the syntax used in the below line:
On the other hand, maybe other changes are also needed, for example, how you want to shown or use the value get from the database. If you place an "Input1" control in the app view, and, the below code in the app view Show event, you can see the things working as expected, that is, once the value is retrieved from the database, it's placed in the "Input1" control:
You can also copy the below code in a file and save it as "MyApp.ab", for example, then open it with DecSoft App Builder and run the app:
Yes, I knew that the line: dbRef.on('value', snap => bigOne.innerText = snap.val()); was causing the issue but wasn't sure how to deal with it. Using an input field is a preferred method and I can see how you code is working so thanks very much.
I still have to deal with firebase authentication, messaging, chat, etc... but you have got me started and I appreciate it.
Cheers, PeteI have spent quite a bit of time getting the hang of AB and have circled through various technologies such as pouchdb/couchdb and various other solutions but have settled on Firebase as the back-end that I would like to use.
I think that Firebase will be a great solution because it already has functionality in place to handle user authentication, realtime database, offline first functionality, cloud messaging, in-app messaging etc, it is also free to get started. have also spent quite a bit of time playing and learning Firebase/Firestore and feel that I have a pretty good handle on it.
Firebase offers two types of databases (Real time and the newer Firestore), They recommend Firestore as it is newer, easier to work with and more powerful. However the output of Firstore is not pure json, whereas it is with the RealTime database). I would prefer to work with Firestore but am unclear as to whether the output format is going to make it a lot harder to work with in AB?
The problem that I continue to struggle with is taking working html samples and converting them over to the AB structure rather than working directly with the dom. I was wondering whether you had any experience with Firebase/Firestore and would be able to point me in the right direction. I am looking to create a very simple test application where I can write data to the database and retrieve it in a report object, preferably with the ability to edit and delete records.
I appreciate that you are busy and I certainly appreciate all of the assistance that you have given me to date but I was wondering if you could give me a hand getting out of the gate on this as I am keen to really get going on this project. The main documentation can be found at https://firebase.google.com/docs/web/setup and https://firebase.google.com/docs/firestore/quickstart. There is also a codelab that can be found at https://codelabs.developers.google.com/codelabs/firestore-web/#0.
The three questions that I have at this point are:
1.From what you can see at this point,would I be able to move forward with Firestore or will I need to work with the RealtimeDatabase due to the fact that the output is pure JSON?
2.Would you be able to edit the following project to get it writing and reading the data back? I have setup a test project in the Firebase console with anonymous user access and have put the config/credentials into the AB project.
Hello Peter,
The problem is, of course, the time... I am busy with some customer's projects, also with my own ones... I have no time, for sure, to start to read about Firebase in a deep way right now, Peter. Maybe in the future, but for now maybe we can go ahead in a step by step way...
In principle, whatever thing that you can see working in an HTML file... must work in AB, because our AB apps are also HTML... of course we need what happen in the HTML file, what we do in that, in order to maybe "translate" and do the same thing in AB.
You mention that the database that you want to use don't provide JSON, but, you don't mention what is the format that the database provide... maybe you can use that format directly in AB (again, if the HTML file do it... in principle we can also do it...).
Another possible solution is to use a "bridge" between the database and our app. That is, we can prepare an app's server script, who deal with the database, and finally provide to the app the right data, maybe already converted to JSON, if we wanted that.
So please, try the above, and, of course, if you find any specific error or problem (this is important, that is, to be specific), don't hesitate to post it here, and we will try to help you as bes as possible.
P.S. I want to try your provided app XML, but, can't open it properly... please, take a look... and, if once you be sure that the code is correct, post it here: if then don't work... maybe you need to send me this specific XML (app) using my E-Mail address...
Hello Peter,
I am curious anyway... what kind of output provide the "non JSON" one? But it's ok... maybe this is not important (right now...), so yes, go ahead, start with what you think that you must to do, and, of course, on any problem, specific error, unexpected result, etc., post it here and we will try to help!
I will take a look... but I start by search for "output" and no results found... :-(
Hello Peter,
If I am not wrong, the "console.info" don't work.... in the internal debugger... but for sure work if you try the app in a browser like Firefox with the developer console opened... so look if you can see something there... because at a first view the "Promise is undefined" error message don't say too much...
Databases:
firestore:
realtime:
Hello Peter,
So maybe what happen is that the Firebase related Javascript is not compatible with Internet Explorer 11 (which is the internal debugger browser)? About the output... are you sure that we are not talking about JSON too? Maybe with a different format, to say like that... but finally some JSON objects?
I think we are talking about Javascript objects variables with their properties and values, because, what else? Maybe some defined data structure provided by the Firebase Javascript? We must talk about objects... but maybe "masked" by that structure...
Anyway... what is the problem, Peter? Sorry but I start to miss around (maybe we are mixing various things at the same time, and it's better to be more specific I think) can you output in the console the values that you get from the database? If so, what you can see? Is that the problem now?
P.S. If I am not wrong, the Firebase Javascript related code have some problem to run in Internet Explorer 11... you need to search around this too... and see if, in case that that code can't work in Internet Explorer 11... asume that the app can't work in Internet Explorer 11...
Hello Peter,
If I am not wrong, you can modify your code in order to do something like this:
"querySnapshot" is already an Array of objects, which is what the Report.Data must be.
Hello Peter,
I am wrong... we can't assign the variable directly to the Report's Data... we must do something like the below:
You can try that code "as is" in the app sample that you sent to me before. Right now I am not sure if the above code cause that the stuff don't work in IE 11... or if is the core code of the library... maybe the above code can be changed to work in IE 11 too...
Hello Peter,
Please, don't worry at all! I am happy to help when possible! So don't hesitate to ask what you need, but, please, try to be specific, so we can focus on certain specific error, unexpected behaviour, etc. For example, Firebase appear very interesting, but, my god, I have no time right now to study Firebase properly... (and unfortunately I don't know it already) but as you can see I can help anyway... by feed the Report, for example, etc.
Maybe in other situations I can deep into certain API, etc., but, right now I am really busy... and I am sorry for that.
P.S. About the IE 11 problem... I try this way:
But then I fall from my horse, because the error which appear in the console is related with the "firebase.js" script... so I am not sure (right now) what happen... but to me is strange to avoid IE 11... maybe at least this must me documented in some where... at least one thing can be added here: testing the app in Microsoft Edge works as expected...
P.S.2. My modified code don't work even in Edge... so don't think on use it, but use the code that works like expected. :-/
Hello Peter,
If I am not wrong (and am I thinking in the same quotes), the quotes are placed in your code because is required, that is, "Title 1" is a string value, therefore must be placed inside single or double quotes in Javascript.
However, talking about variables, we no need the quotes, in fact, if we use the quotes, what is used is the name of the variable, to say like that, so the below code must work:
No problem, Peter, I perfectly understand it! :-)
Hello
You must unblock the app in the "then" function, maybe at the beginning or just before "$scope.$apply()". On the other hand, you are trying to use "window.App.RootScope.UnblockApp", but, if I am not wrong, what you wanted is the Javascript code of the AB function... in this case is "blockUI.stop();" (without the quotes).
P.S. Please, Peter, consider to open another thread, maybe a "volume II" if you wanted.
Hello Peter,
The way to know what Javascript produces certain action, is to take a look at the "app.js" file: we can do it from the program's menu too.
Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.
Este sitio utiliza "cookies" útiles para almacenar sus preferencias.