#1 2016-10-12 01:22:01

Souleymane
Member
Registered: 2016-10-12
Posts: 6

How to display an AlertBox each some specific days

Hello, first thanks for such incredible software. I just discovered App Builder and I'm trying some things.
Can you tell me how can i display AlertBox with message each 7 (or specific) days ?
i tried with cookies but it's not working ! Thanks

Offline

#2 2016-10-12 10:01:41

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to display an AlertBox each some specific days

Hello Souleymane,

Thanks for your interest in my work at App Builder and thanks for your kindly words. Please, consider also to buy one or more licenses of the program: that's the way to maintain it well maintained, updated and supported.

About your question, certainly we have Date related actions so we can compare, for example, a date with another, and determine the number of days (for example) between the two dates. But how you plain to implement that?

I say, do you plain to maintain your application running? Then a Timer control may can help. Do you plain to test the "days between" when the application starts? You can do it using cookies, the local storage, the File plugin (if you work with Cordova) or a server side solution.

The point is you must save a Date (timestamp value, for example) into one of these possible storages, and then compare it with the current Date when the application starts or when an Timer control's Interval event is fired.

Please, let me know if this information can helps you in some way or if you need any further help.

Online

#3 2016-10-12 14:05:23

Souleymane
Member
Registered: 2016-10-12
Posts: 6

Re: How to display an AlertBox each some specific days

Hello David,
Thanks for your reply.

The thing i want to do is:

I put a Alertbox on the home page, and I want when user opens the app for the first time this Alertbox appears, and when the user closes the Alertbox it no longer opens until a specific time.

Even if the user closes and reopens the application, if the specific time has not arrived yet, the Alertbox not displayed.

Sorry for my bad english ! i'm trying ! hope you understand !

Have a nice day !

Offline

#4 2016-10-12 14:37:49

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to display an AlertBox each some specific days

Hello Souleymane,

As I said before, a possible approach is to store a timestamp into the app's storage. Then we can compare such timestamp with the current one, and shown the alert to the user. I prepare an small application sample for you. This application sample have only the below code in their unique view's Show event:

// To "start from scratch" this sample uncomment the below action and then comment it again
// ClearOptions

// First of all get the option in which we save the appropiate timestamp
GetOption "LastNoteDateOption" "[LastNoteDate]"

// When the application starts for the fisrt time, the option variable is empty

If "[LastNoteDate]" "==" ""

  // Then we save the current timestamp into the appropiate app's storage option

  SetOption "LastNoteDateOption" "[App.Timestamp]" "String"

  // And alert the user this is the first time the application is running

  AlertBox "This is the first time the application is running and here is the alert!" "info"

Else

  // If the option variable is not empty, we have a previously saved timestamp
  // In other words, the application has been running at least one time

  // Then proceed to create a couple of Date variables: one to store the current
  // date, and another to store the saved option's timestamp value.

  NewDate "" "" "[NowDate]"
  NewDate "[LastNoteDate]" "x" "[SavedDate]"

  // Once we created the Date variables we can play with them, for example, obtaining
  // their differences in various units like seconds in this example

  DateDiff "[NowDate]" "[SavedDate]" "second" "[Seconds]"
  Round "[Seconds]" "[Seconds]"

  // Now, if the application is running after 20 seconds from the previous run, an alert
  // is shown to the user. But note how we firstly save the current timestamp again into
  // the appropiate app's storage option, so, when the user run again the application they
  // are not alerted... if the previous execution is before than 20 seconds in this case

  If "[Seconds]" ">=" "20"

    SetOption "LastNoteDateOption" "[App.Timestamp]" "String"

    AlertBox "This alert is shown because you enter in the application 20 seconds after the first alert!" "info"
  EndIf
EndIf

What you can expect when execute the application is this behaviour:

1º The first time that you run the application an alert is shown to the user.

2º If then you refresh the application you can't view any alert.

3º If you refresh the application or run it after 20 seconds (in the sample) then the alert is shown to the user.

You can change the DateDiff action's unit to "day" in order to get the dates difference in days, so you can shown the alert to your user after N days if you wanted.

You can download the sample application from the below link:

AlertOnTime.ab

Hope they can help you in some way.

Online

#5 2016-10-12 15:30:05

Souleymane
Member
Registered: 2016-10-12
Posts: 6

Re: How to display an AlertBox each some specific days

Thank you very much ! Now it's working like a charm!

Sur i'm looking forward to get a license. But for making some complex apps i have to master AngularJs ?

I mean by "complex apps" somethings like dating apps, Messenger, quizz, quotes....

Last edited by Souleymane (2016-10-12 15:32:19)

Offline

#6 2016-10-12 15:33:30

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to display an AlertBox each some specific days

Hello Souleymane,

Souleymane wrote:

Thank you very much ! Now it's working like a charm!

Sur i'm looking forward to get a license. But for making some complex apps i have to master AngularJs ?

Thanks in advance for your support sir. Certainly we no need to know about Javascript nor the AngularJS framework, because we can base our applications in the "out-of-the-box" actions included by App Builder. However, since App Builder uses the AngularJS framework as well as Javascript, any knowledge about can be fine for us sometimes.

Please, let me know if you have any further question.

Online

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.