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

Text-Mode

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

    Text-Mode

    While working with a list control's detail view. I have my "Save" button run this on click code (text mode)

    Code:
    1. {dialog.Object}.ajaxCallback('',1,'__A5SystemGeocodeAddress','','__address=Invoicelog_Address&__city=Invoicelog_City&__state=Invoicelog_State&__zip=Invoicelog_Zipcode&__country=&__latitudeField=lat&__longitudeField=lng&__part=O&_rowNumber=1&_geocodeMethod=Google');
    2. {dialog.object}.runAction('setnotdeployed');
    3. var lObj = {dialog.object}.getControl('ANIMALS');
    4. lObj.updateListFromUXControls();

    My question is shouldn't this code run in ORDER by line number? It seems geocoding the address and running the setnotdeployed run action make the list dirty AFTER the save instead of happening before it.
    Thanks for your input!

    Charles
    Last edited by CharlesParker; 07-30-2016, 02:42 PM.
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

    #2
    Re: Text-Mode

    You already know javascript is asynchronous. Chances are that geocode piece is actually returning it's values after other lines have executed.

    A5 to the rescue (and yes, there's more than one way to do this, but this is simple):

    Code:
    function one() {
      {dialog.Object}.ajaxCallback('',1,'__A5SystemGeocodeAddress','','__address=Invoicelog_Address&__city=Invoicelog_City&__state=Invoicelog_State&__zip=Invoicelog_Zipcode&__country=&__latitudeField=lat&__longitudeField=lng&__part=O&_rowNumber=1&_geocodeMethod=Google');
    }
    
    function two() {
    {dialog.object}.runAction('setnotdeployed');
     var lObj = {dialog.object}.getControl('ANIMALS');
    }
    
    function three() {
     lObj.updateListFromUXControls();
    }
    
    A5.executeThisThenThat(one,two,three);
    This may be overkill (or underkill -maybe four is better) - see what happens.
    -Steve
    sigpic

    Comment


      #3
      Re: Text-Mode

      What does 'setnotdeployed' do?

      Sometimes I'll use executeThisThenThat, and other times I'll return JS code from the AjaxCallback to run the balance of the process. It depends on what needs to run in the process.

      You can return a call to a JS function which handles the balance of code.

      Comment


        #4
        Re: Text-Mode

        Originally posted by Steve Workings View Post
        You already know javascript is asynchronous. Chances are that geocode piece is actually returning it's values after other lines have executed.

        A5 to the rescue (and yes, there's more than one way to do this, but this is simple):

        Code:
        function one() {
          {dialog.Object}.ajaxCallback('',1,'__A5SystemGeocodeAddress','','__address=Invoicelog_Address&__city=Invoicelog_City&__state=Invoicelog_State&__zip=Invoicelog_Zipcode&__country=&__latitudeField=lat&__longitudeField=lng&__part=O&_rowNumber=1&_geocodeMethod=Google');
        }
        
        function two() {
        {dialog.object}.runAction('setnotdeployed');
         var lObj = {dialog.object}.getControl('ANIMALS');
        }
        
        function three() {
         lObj.updateListFromUXControls();
        }
        
        A5.executeThisThenThat(one,two,three);
        This may be overkill (or underkill -maybe four is better) - see what happens.
        Oh, cool! I'll have to remember this one myself Steve :)
        Alpha Anywhere v12.4.6.5.2 Build 8867-5691 IIS v10.0 on Windows Server 2019 Std in Hyper-V

        Comment


          #5
          Re: Text-Mode

          What does 'setnotdeployed' do?
          That is an ajax callback to execute an Internal xbasic function that updates another table, and that may take awhile to complete (not much, however - timing is everything).

          Code:
          function setequipment as c (e as p)
          	'Function sets the equipment Is_Deployed to NO 
          	'when someone picks up an animal and pulls the trap.
          
          dim cn as sql::Connection
          dim args as sql::arguments
          cn.open("::Name::Connection1")
          seteq = <<%txt%
          UPDATE alphanwcopro.companyequipment
          	SET 
          		Is_Deployed = "No"
          	
          	WHERE Serial_Number = :theserial2 
          %txt%
          	
          if e._currentRowDataNew.Is_Deployed = "No"
          	args.set("theserial2",e._currentRowDataNew.Equipment_Serial_Number)
          	
          cn.Execute(seteq,args)
          end if
          cn.close()	
          	end function
          Then once the javascript is complete - I now run the list update in the after call back complete and it seems to be working otherwise I was getting an error stating I needed to save the detail view - even though all the code was executing so I figured I would ask.


          Call me DUMB because although I know javascript is synchronous - but for some reason I always assumed that in text mode (maybe the line numbers made me think it) that it would all run in ORDER.

          SO therein is my fault. Although - Steve threw in a pretty cool idea that I will refer to in the future when I have too many things going on and want to execute in a certain order.


          David, if you were going to offer a way to set a delay on that preceding action I would still be open to your thoughts even for the sake of just knowing your thoughts!


          SOMEDAY - I hope to update IsDeployed from a QR code scan!
          NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

          Comment


            #6
            Re: Text-Mode

            Don't ignore what David's suggesting - it's often a better alternative. What he's saying is that when you have a callback, it's often a good idea to let the callback fire the next javascript you need. This is another way to insure that the callback is complete before the next javascript function is executed. Example:

            Code:
            function setequipment as c (e as p)
            ' . . . . do all your stuff here as you are
            
              js = "{dialog.object}.runAction('setnotdeployed');"
              setequipment = js
            
            end function
            In fact, I often prefer this method over the A5.executeThisThenThat() .
            -Steve
            sigpic

            Comment


              #7
              Re: Text-Mode

              It really depends on what you want to do and how you have functions set up. If your xbasic functions are independent, then you'd need to set up a flag system to tell when you want to execute stuff.

              You can also use the client-side event afterAjaxCallbackComplete... very handy. This gives you e.xbasicFunctionName and e.ajaxEvent

              You could put a switch statement in there to test what's just completed and to run what's next.

              I wouldn't use a setTimeout() delay in this case... server callbacks are too unpredictable for timing. And I wouldn't use a runAction either... just use the .ajaxCallback method.

              Comment


                #8
                Re: Text-Mode

                Yes, so at thsi point as I said I am using the after Ajax complete to run the code to update the list control at that time and that's really all I needed to do - and there is nothing else to run after that, although I have had other UX's where there was a lot going on and it took me a while to figure out the order of how I wanted it all to fire.
                Thanks guys for your input on this!
                NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                Comment

                Working...
                X