Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Using Xbasic functions in a UX

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using Xbasic functions in a UX

    {Dialog.Object}.ajaxCallback(,,xbasicFunction,additionalData)
    I need to use a function in xbasic that calculates the age of a person at their date of death
    I have created a UX with three fields and a button the first two fields are date fields, one is the �Date_of_Birth� and the other is the �Date_of_Death� the last field is a numeric field I called �DeathAge�. This is the classic start date end date issue that I would handle with a calculation field on a form using the Age() function in xbasic.
    I realize that this could probably be calculated in java script but I would like to learn how to use the plethora of xbasic functions on a UX especially the Time and Date functions.
    I believe that I am somehow supposed to know what to do with the statement above
    I need to know how to address the variables on the UX such that the are available to the serverside x basic. but I am not at all sure how to do that I think it has something to do with state variables which I really don�t know anything about. I decided to activate the action using an on click event of a button as I could not really see how to get something to happen with just entering the field or something which I don�t know about.
    So my question is how can I use the Age() function so as to show the number of the age of the person in the �DeathAge� field on my ux after I enter the Beginning Date and Ending date. I have seen a lot of videos and looked through a great many threads concerning this issue and it still isn�t very clear to me what I need to do or where I need to do it. I suppose there are many ways this could be accomplished which is why I am not quite sure what to do. When you look at this it is all a bit daunting and you tend to get turned around quite a bit following one explanation after another that don�t seem to fit. I don�t really understand why we should have to drop all of the functions in xbasic that have been built over twenty years and have to remake them in java script.
    Any clarification of this rather simple problem would be appreciated as I think it would open the door for a lot of other users as well.
    Thanks

    #2
    Re: Using Xbasic functions in a UX

    Are you using SQL? ...if so how about using a computed column? Add a new column ('deathage' maybe?) and in that column's Computed Column Specification try this formula: (datediff(day,[Date_of_Birth],getdate())/(365))

    For a java-script solution try Googling "calculate age in javascript from date of birth". Several solutions come up. You could adapt the code for your age at death purposes. Using JS, as opposed to xbasic, would be ideal and faster. Xbasic makes a round trip to the server which could slow performance depending on what else is going on in your app.

    As for xbasic take a peek at this thread: http://www.alphasoftware.com/alphafo...t-January-1st-!!!

    It talks about various things age related.
    Last edited by mikeallenbrown; 12-08-2015, 09:13 PM.
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant​​

    Comment


      #3
      Re: Using Xbasic functions in a UX

      http://screencast.com/t/QHud0BXXAo2v
      take a look at this. just want to remind you
      you do not need a button. there are events that can be trapped to trigger the button action on the web side.
      this will require a trip to server, wasted energy, can be done easily in javascript.
      dividing the days by 365 will not be accurate since there are leap years to contend with. i have posted various codes to calculate age in the code section of this forum.
      you might want to take a look.
      good luck in the mean time.
      thanks for reading

      gandhi

      version 11 3381 - 4096
      mysql backend
      http://www.alphawebprogramming.blogspot.com
      [email protected]
      Skype:[email protected]
      1 914 924 5171

      Comment


        #4
        Re: Using Xbasic functions in a UX

        If I understand what you are saying you want to do an ajaxcallback, here is an example of one that I did. I set up the callback in action javascript. See the screenshot. The javascript and xbasic functions are below. You can use the alpha anywhere date and time functions to do whatever you need to. You can send back javascript that can essentially do a {dialog.object}.setValue to return the calculation to alpha anywhere.

        What I'm doing in case your wondering, is when the initial login dialog is validated I do some localstorage.setItem to save my session variables. Before I sync I make sure the session variables are defined so I execute this callback to restore the session variables in case they timed out on the application server.

        ajaxcallback.PNG

        function getSessionVars() {
        var _str;
        _str = '_providerid='+ localStorage.getItem('providerid');
        _str = _str + '&_username='+ localStorage.getItem('username');
        _str = _str + '&_today='+ localStorage.getItem('today');
        _str = _str + '&_firstdate='+ localStorage.getItem('firstdate');
        _str = _str + '&_semesterid='+ localStorage.getItem('semesterid');
        _str = _str + '&_servicemonth='+ localStorage.getItem('servicemonth');
        return _str;
        }



        function xbresetSessionVars as c (e as p)
        'xbresetSessionVars = "javascript commands to be executed in the Browser."
        'debug(1)

        session.providerid=request.variables._providerid
        session.username=request.variables._username
        session.today=request.variables._today
        session.firstdate=request.variables._firstdate
        session.semesterid=request.variables._semesterid
        session.servicemonth=request.variables._servicemonth
        'xbresetSessionVars = "alert ('" + session.providerid + "');"
        end function

        Comment


          #5
          Re: Using Xbasic functions in a UX

          Thank you so much for your advice and guidance I will look into these options. I did look at that thread and found a lot of good information in it. But for me it was still a bit difficult to follow.
          Thank you so much

          Comment


            #6
            Re: Using Xbasic functions in a UX

            Wow! Awesome! Thank you so much. It demonstrates exactly what I wanted to do and how to do it. Thank you! Thank you! Thank you! This will help me a great deal at getting started and clarifies many aspects. I will study your other contributions. This will help a lot of others also who are a bit overwhelmed by all the ends and outs of these procedures. I was stumbling over all the literature and variations. I mean the first thing you do is start to read the help files and threads. Then you look at one video after another a very time consuming learning curve along with hours of fooling around with ideas.
            I know these things can be done in Java script and it is not too difficult to understand but I want to say you are making a huge contribution with your videos.
            Thanks again.

            Comment


              #7
              Re: Using Xbasic functions in a UX

              I can see I am not addressing each post the way I wanted to so my above two posts are to mike Brown and GGahndi with great appreciation and thanks also goes to the post by Kenshap I really appreciate the input it is very helpful I will study what you have shown me thank you all.

              Comment

              Working...
              X