Hello again,
I forgot to say that the [App.Cordova] global app's variable. This variable store "true" if the app is running in an Apache Cordova WebView, in other words, if the app has been compiled using Apache Cordova and run in Android, iOS, etc. The variable store "false" if the app has not been compiled with Apache Cordova, in other words, run in an browser or as an browser's Web Extension.
Hello Paolo,
Please, upgrade your AB copy. Among other changes, you can see two new app's global variables: [App.Url] and [App.Debugger]. The second one store "true" if the app is running in the App Builder debugger and "false" if not. However, note that if we launch the app in another browser, for example, Firefox (which is recomendable, because the App Builder debugger console is not so good than the Firefox one, for example), the [App.Debugger] variable stores "false".
The first new variable [App.Url] may can be useful too for your purposes, since this variable stores the URL of the app, for example, "http://127.0.0.1:9999/#!/View1", so, with the help of some actions we can determine if the app is running in an "local URL" or not, for example:
We can place the above code at the start of the app (for example, in the main view Show event) and prepare an variable instead to shown a message, that is:
Then we can use the [AppIsRunningInLocal] variable when needed.
Hello Paolo,
I am not quite sure if can understand the first part of your question, but, maybe by solving the second part you get solved the first one. Certainly, other IDEs like Delphi, prepares an Tag property for their components, however, I am not sure if in App Builder that property have some sense, better said, the same sense than in Delphi.
Anyway, certainly it's completely possible to add new properties / variables to an control in App Builder, for example, this code works as expected:
You can do the above without problem, and, after that, the "MyButton" control have an "Tag" property / variable with the value "123", in this case. Can this be useful for you Paolo?
Hello Paolo,
I think that can understand what you wanted, however, I am not sure if something like that can be good. Commonly we can use variables, so, maybe it's not a good idea to replace the brackets in all the cases. Use brackets "as is" is probably more rare than use variables.
Hello Paolo,
Glad to know that you got it. And thanks for sharing the NodeJS configuration: may can be useful for other people too.
Hello Paolo,
If I am not wrong, the problem is related with the CORS permissions. Maybe the thirdparty server don't allows HTTP calls from client apps. If this is the problem (and I think so) you must prepare your own bridge in your own app's server. Then your app communicate with your server (who provide the right CORS permissions) and your server is responsible to communicate with the thirdparty API and provide you the right response.
You can take a look at various AB samples like SimplePost, HttpClient, etc. Take a look at the included PHP script in the samples. As you can see, that scripts setup the right CORS permissions, to allows the app to communicate with the server / scripts without problems.
Hello Paolo,
You say that the above don't work, but, do you get some error message? Please, try the app by opening it in Firefox, and, press the F12 key in order to open the developer console. Then, take a look at the request, and, if you can see any error or something that we can use to find a possible solution.
Hello Paolo,
May something like the below can be enough:
In the Result variable you have an JSON string representation of MyObject.
Hello Paolo,
I am not quite sure about what the problem can be. Maybe you have an problem with the variables in the URL? Certainly, if we must place something like "[this]" in the URL, since "[this]" appear as an AB variable, maybe we can have some problem. Maybe a possible solution can be to use HTML entities instead of the brackets "as is".
I want to shown here the HTML entities, however, they are converted to the brackets... so I can't shown to you here as I wanted. But take the idea: instead of use the brackets "as is", you must replace the brackets with their HTML entity representation, so AB don't take it as variables.
If something like that don't work as expected, maybe you need to prepare some "bridge" between the API that you want to use and your app, using some server script placed in your app's server. So you can use URLs without the "brackets" (all of these suposing this is the problem, I am not sure!), and then your server script made the appropriate calls to the API (here we can use "brackets" without problems) and provide to the app the API response.
But I must insists, Paolo, I am not sure if the brackets are the problem or not. Do you get what you wanted? If not, do you get some error message?
Hello Paolo,
It's difficult to help without more details. For example, I am not quite sure if the "HttpSetHeader" is really needed. But anyway must work. On the other hand, about the URL that you try to conform, certainly I can see something "rare"
Maybe is a mistake when copy the URL and variables, but, this have not too much sense: [where][0][email]
Maybe you want to conform an URL like the below one?
That URL must work, in principle. Maybe you can use the EncodeURI action, but, I am not sure.
Finally, the point is, what is the result that you expect and what is the result that you get? Some error message?
Hello Paolo,
I am not quite sure if can understand perfectly, but, one of the possible aproach can be the below one. Supose we have an container like this in an HTML control:
Then, in our app, we can establish the "ContainerClasses" variable in a way like this, for example:
And... the result is the expected, that is, the "ContainerClasses" CSS classes are applied to the HTML container.
Note that is also possible to establish some CSS classes "by default", in an container like that:
Then we can set the other CSS classes using the variable:
In both cases the "bg-danger" and "text-white" CSS classes are applied to the HTML container.
Hello Paolo,
LoadVariables, as you said; also place that HTML inside the HTML control and use just some variables for some specific content; a sole variable in the HTML control to be feeded by the response of an HttpClient control. Using pure Javascript in order to feed the HTML control by their ID (which is their name in App Builder),... and may others ways too... :-)
However, apparently you want to shown an modal dialog... please, remember we have the "ShowDialog" action to shown app's view as dialogs. And we have also the "MessageBox" action, which is also very powerful, as you can see in the MessageBox sample.
Hello Paolo,
The error message is more or less obvious this time: "cordova" is not defined, in other words, can't be used. Certainly what happen i that the Files sample requires to compile the app with Apache Cordova first. In fact we only can write files from an Cordova's compiled app, that is, our apps cannot read files if they run in a browser, for example, which is good (just imagine than an webpage can read your own files...).
Hello Paolo,
I can understand. However, the component that you mention is not for Angular 1.x, which is used by AB, but for Angular 2.x. This frameworks are not compatibles, so, probably it's difficult to implement exactly the component that you wanted, Paolo. You must look for another possible way to shown what you wanted. And of course, if you need any help, please, don't hesitate to post it here or just open another forum thread.
* How you can do what you wanted? Maybe an HTML control below the navbar, so you can show there the icons that you wanted, etc. There is not only a way to do the things, so, I am sure that you can find one useful approach.
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.