Posts by DecSoft

Show threads by DecSoft
3341 posts found, page 218 of 223

DecSoft (In thread: Modify the Report Sample App to include functions (Add, Edit, Delete)?)

Hello CIS,

First of all, note than the "InputBox" action callback must be an app function, not an action like "StrReplace" as you write. Take a look at the InputBox app sample for more information. On the other hand, probably you need to decide what action execute next: "HttpExecute", "SimplePost" and "SimpleGet" probably cannot be called like you write above.

If you choose to use the HttpClient control to made an HTTP POST it's ok, but you no need to call "SimplePost" at all. On the other hand, "SimplePost" do not offer any feedback, then maybe it's not the right action in your case. Finally you call the "SimpleGet" action, but, again, probably you no need to do something like that CIS.

You can play with the app using a local webserver (*), just remember that if you want to use PHP and MySQL these stuff must be available and running in the local webserver too. We need to think our app is a act like a web page in these scenarios, and therefore we must made the appropiate HTTP GET and POST requests. We can need more or less calls, the Report control or others, depending of the app we made.

If you start with the app I can help you in some particular points when you need! In other case I can't promise when I a possible app sample like you wanted can be ready since I am very busy right now with other App Builder stuff.

(*) Remember that App Builder debugger starts an HTTP local server, then, if you need to work with other local server you must use different ports. By default App Builder uses the 9999 port and this can be changed in the program options dialog from the Menu -> Edit -> Program options.


DecSoft (In thread: Modify the Report Sample App to include functions (Add, Edit, Delete)?)

Hello,

As an addition to my previous message I want to say than the Report control is very powerful and right now App Builder include four different samples: Report, Report2, Report3 and Report4.

A Report control can be feed using their URL variable. Then the control automagically perform the HTTP request, retrieve the response and prepare the data to be show into the Report table.

Maybe we are a bit confusing with the samples "data.json" and "data.php" files. In fact we can include files like "data.json" in our apps in order to feed a Report control with the file app local URL.

"data.php", instead, is a sample of how the JSON data can provide from a webserver and therefore can be dinamically changed or updated in order to allow our apps to show the latest information.

On the other hand, the Report control can also be feed by using their "Data" variable instead their "URL" variable. And this can be made at least in two ways: load JSON data using an action like "SimpleGet" or prepare our own JSON object using the object related actions.

This last way is particularly interesting because we prepare the JSON object in runtime and therefore such object can contains different information in different scenarios. The App Builder's Report3 and Report4 show to us how to do something like this.

That's all! Hope this information can be useful!

Don't forget to play with the App Builder's app samples!


DecSoft (In thread: Modify the Report Sample App to include functions (Add, Edit, Delete)?)

Hello CIS,

Certainly we can prepare the required stuff to not only retrieve and show information from a webserver, allowing to add and edit information too, but probably this is out of the scope of the Report app sample. Maybe we can prepare an specific app sample to doing something like you wanted, however, in the meanwhile, note what are the required stuff in order to do something like that:

1º We firstly need a webserver capable to receive HTTP GET and POST requests and also to store the information in some kind of database like MySQL, for example.

2º We need to prepare some kind of API accesible by HTTP calls in URL like the below ones:

3º We can use a Report control to process and show the JSON data provided by the "get.php" HTTP requests. Note we can add some arguments to the URL in order to retrieve specific information, for example, this URL:

... can produce different results than this other URL:

4º The "edit.php" script can be ready to accept some record specific ID, for example:

The above URL can respond with a ready to parse variables list text like these:

We can use the "ParseVariables" action to get the variables from the response and show their content in a couple of Text input controls.

5º The same app view which show that Text input controls can have a Push button to made an HTTP POST request to the same "edit.php" script, providing the updated information of the edited record.

6º In order to add new records to the database we only need the appropiate Input controls and to made an HTTP POST request to the "add.php" script, providing the appropiate record information.

Probably this is not a complete answer since I do not add what you wanted to the Report control, but I tell you how something like that can be made using App Builder. Maybe in the near future we prepare an app sample around this.


DecSoft (In thread: NeoPlugins - Parsing an HTML table)

Hello Nelson,

I think we can use npXmls but they require too much work than use npRexp. npXmls is a very complex plugin which allow us to parse arbitrary XML, but requires some work in order to get ready for what we wanted. npRexp is more close up to this kind of problems, since we can provide a regular expression of our search query and simply get the available matches.


DecSoft (In thread: NeoPlugins - Parsing an HTML table)

Hello Nelson,

Probably npXmls can do the job too, but I think npRexp can be better here. I modified one of the npRexp samples in order to search for "pcom" data in your HTML table. Take a look if you wanted here:

Sample download

I just modified a little the application sample, then probably we can get better results: it's a question of time, some npRexp study and adapt the plugin to our own publication.


DecSoft (In thread: load array with LoadVariables action ?)

Hello Walter,

Various things to consider here.

4. If I change something in these files IE accepts it immediatly, Chrome and Firefox donn´t . although I pressed F5 different times and I empty the cache manually ...

I test right now in Internet Explorer, Firefox and Chrome and works like expected. If I load a file with two variables "a" and "b" I can use "LoadVariables" or "ParseVariables" and then access such variables. If then I change the file and add a new "c" variable, when I use again the refered actions, there is no problem to get the value of the new added variable.

If we are talking of files included by the app, remember that you can edit the original file, but the app have their own copy of the file! If the argument for the "LoadVariable" action is an remote URL (a remote file) then this must work like expected if you edit the remote file, however, remember "LoadVariables" is not the best way load remote files, because we have no feedback.

"LoadVariables" is mainly intended to load variables for an HTML template, that is, the content of an HTML control. We can use in other scenarios too (for my above test I did so) but it's not recomended, since "LoadVariables" do not offer any feedback about their success or error. This action is also intented to work with local (app files) because these files always exists and we can expect a more or less response from the app server.

5. I checked the ParseVars sample different times made some test in my app, also using HTTPexecute. BUT the thing is with HttpExecute action I stop the script, all script actions behind HttpExecute will not be executed.

Something wrong in your script? Because, in fact, for remote files (not app files) the "ParseVariables" is the way instead of "LoadVariables", and, in order to use this action we need the help of an HTTP Client control, like the sample you mention does. I try right now with the "ParseVars" samples and try to modify the remote variables file and all works like expected Walter.

Yes, the "ParseVariables" action can be used to get variables not only to be shown in an HTML content control, but also to use in other possible places, however, we need to take care about the flow of our app. As you know, all the actions are executed asynchronously, that is, be can't expect the variables are ready just after execute the "HttpExecute" action, we need to wait for the "Success" or "Error" events of the HTTP Client control, and use the HTTP Client response as the argument for the "ParseVariables" action.

Then we need to think in that before count with the variables: we can't use the variables until the HTTP Client control "Success" event and the "ParseVariables" call, and we also need to prepare some scenario for a posible "Error" event. Both scenarios depend on what kind of thing we try to do, I just can say at this time that both "LoadVariables" and "ParseVariables" actions works here in all the browser I test, then maybe you have some problem with your script. Maybe you can send me or prepare a sample to try to reproduce the problem?

6. So my question is, if there is a possibilty to start i.e a function "loadthis" in the show event of an view and WAIT for the end of the function before continuing the show event script. For example with a while which is waiting for a response var of the function

No. I think there is not a way to do such thing Walter. Every action are asynchronously executed. However this not meant we can't do the things, just that we need to think about how to do what we need in an asynchronous way. Then, if you want to execute "something" when the "ParseVariables" end their work, why don't prepare an app function with the "something" stuff and call to that function just after "ParseVariables" in the HTTP Client control "Success" event?

Supose we have two app functions named "GetVariables" and "ProcessVariables". Then our app view "Show" event can look something like this:

1º We call "GetVariables" and that function basically call the "HttpExecute" action to retrieve the remote variables. There is not more stuff in the app view "Show" event.

2º Once the "HttpExecute" is called we wait for the "Success" event of the HTTP Client control. In that event, we use the "ParseVariables" action (using the "[HttpClient1.Response]" variable as argument) and inmediatelly after call to "ProcessVariables".

That's all. We no need to wait for some action execution in the "Show" event, instead of that we "start" the process for retrieving the remote variables file and process the variables when they are retrieved.

7. As far as I understand now the show event script of a view is first read totally and then executed?

I am not sure if understand well, but this and all events and pieces of code are executed following the action's sequence.

8 And last but not least: Do different browsers handle the SetOption and GetOption different? Do they use different webspace? I wrote a own temporary log function which uses SetOption for the log entries. And get different resuklt using IE and/or Chrome/Firefox. confusing!

"SetOption" relies in the "LocalStorage" of every browser. In principle they must work in a similar way. It's just an space to save pairs of keys and values for our apps, then this keys and values must be the same in every browser if we save the same for the keys and values couples. There is no differences in how App Builder deal with this in different browsers Walter.

Hope this all can help you in some manner, but, remember to post here (or in a new thread) whatever you wanted.


DecSoft (In thread: Code minimizer > Sorry an error occur ....)

Hello to all,

The App Builder Code Minimizer tool (GUI) has been enhanced in order to offer information if an error occur. This information has before available when use the App Builder CLI (command line compiler) but not in the GUI version of the Code Minimizer tool. Now both offer us the same information if an error occur while minimize our apps code. Commonly this kind of errors appear by some syntax mistakes and the information provided by the error can be very useful to locale and fix the problem.


DecSoft (In thread: How to add new Cordova plugins please ?)

Hello,

Just to mention another possible approach we can take here: define a Javascript app function. We can define a Javascript app function (instead of an App Builder script function) with two arguments, "phone" and "message". The code of our function can be something like this:

If we name the function as "SendSMS" then the function appear into the Actions palette under the Function's category and we can call it like:

Finally I add this information as a new Apache Cordova custom plugins App Builder help tutorial. Also I add the new "Plugins" app sample which show us how we can custom plugins like this. Take a look if you like Samuel. :)


DecSoft (In thread: How to add new Cordova plugins please ?)

You're welcome!

Always thanks you Samuel. :)


DecSoft (In thread: How to add new Cordova plugins please ?)

Hello Samuel,

I updated App Builder right now by adding a new Cordova custom plugins option into the app options dialog. We can put in the Custom plugins editbox one or more custom plugins by specifying the plugin ID, for example, "com.jsmobile.plugins.sms" for the SMS plugin we are talking about in this post.

App Builder automatically add custom plugins into their generated Cordova batch files and also into their generated Cordova "config.xml" file. This avoid the need to edit the batch files to add the plugins by ourself everytime we build the app, since the Cordova batch files are regenerated in every app build.


DecSoft (In thread: How to add new Cordova plugins please ?)

Hello Samuel,

You're welcome. Certainly the refered actions can be very useful. However maybe the actions is not documented very well, for example, how we can access app variables from a piece of Javascript added between the StartJS and EndJS actions?

Probably I need to enhance the documentation to talk about this, but, for information purposes, let me to say here that we can access app stuff from the Javascript using the "$scope" and the "$rootScope" variables.

For example, we can modify the above Javascript code in this manner:

In the above code we use the "Input1" and "Textarea1" controls "Value" variable, and also we use the "alertBox" action defined in our app scope. Basically "$rootScope" contains all our app controls and app variables. The "$scope" contains much of the app actions into their Javascript implementation, but not all.


DecSoft (In thread: How to add new Cordova plugins please ?)

Hello Samuel,

Firstly let me to say that I test right now the SMS plugin you refer and works like a charm. Certainly a possible good new App Builder help tutorial can be how to include and use additional Cordova plugins.

Basically we need to follow the instructions of the plugin author, but, in general all the plugins work in a similar way:

1º Setup the app in order to generate Cordova Batch files, for example, for Android.

2º To use the plugin in our app we must follow the author instructions and add this code to a button click event, for example:

As you view above we use directly the plugin Javascript code between the StartJS and EndJS actions.

3º Once the app is compiled, open the "cordova_android.bat" and add the plugin install call:

And that's all! We can build now the app using Apache Cordova in order to get our APK file.

What I can do in order to help a little more this process? Probably I can add some app options in order to allow us to add custom Cordova plugins. Basically I am thinking in some editbox which allow us to put plugin installation calls, in order to tell App Builder these calls must be add into the generated Cordova Batch files.


DecSoft (In thread: MediaPlayer control - questions)

Hello Walter,

About the first question I don't understand what "True/False" means in this scenario. Do you want to disable it or what? Please explain me little more.

About the second question, as you say, disable the context menu help just a bit for downloading the video. If the user is a little smart, probably they can always access the video source. Maybe we can complicate the things from the webserver, but, to be honest, at this moment I can't imagine a way, since our apps running on the client and their source is available, even when minimized and obfuscate it.

Anyway I update App Builder in order to add some stuff related with this second question. I add to the Event's category the new PreventDefault action, and, also add a "ContextMenu" event to the app views and also to the Media Player control. Now we can prevent the browser contextual menu by using the PreventDefault action into the Media Player ContextMenu event in the below way:

We can prevent the context menu for an entire app view or an specific control by using the ContextMenu app view event, for example, the below code into such event prevent the context menu for the entire app view:

We also can disable the context menu for an specific control, for example, a "Button1", using the same ContextMenu app view event in this way:

Then what is the reason we can't use this approach to prevent the contextual menu in the Media Player event? Because the "target.id" of the app view Event variable are empty in this case and we need to deep into the Event object to properly access the Media Player name or ID. So I decide to put a ContextMenu event specifically to be used by the Media Player control.

Hope this can be useful for you, but, if you have any question don't hesitate to post here.


DecSoft (In thread: Code minimizer > Sorry an error occur ....)

Hello Walter,

I recieve the errors capture. Certainly they appear to be some "problem" in your code, in the sense that probably you are using some Javascript code which can cause the problem. Maybe I can help you more if you send me such piece of code. Maybe the problem is not produced by such code but by the interpretation of App Builder of that code. Anyway I need such Javascript code in order to investigate it.


DecSoft (In thread: Code minimizer > Sorry an error occur ....)

Hello Walter,

What about this issue? Finally you get working the code minimizer tool?

Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.