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



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

Chunked Responses

  • Filter
  • Time
  • Show
Clear All
new posts

    Chunked Responses

    Is there a way to put a chunked response into a Serverside AfterInsertRecord xbasic function?

    I am talking here about the following:
    In the AfterDialogueValidate event, you can setup a Server Side action to save data.

    Inside that action, you can run an xBasic script to save submitted data to tables, and inside that you can create an AfterRecordInsert event.

    I would like to send a chunked response from there, but it doesn't look like it supports that because it is not a standard xbasic call.

    I could rewrite my script a little and setup a regular xbasic call after the save, but I have it working fine the way it is - it's just a bit of a long process and being able to show a chunked response would be nice.

    It looks like chunked responses are for AJAX callbacks but I’ll have to take a look further tomorrow. Top of my head though - you could do maybe something like this:

    1. Copy the code you have in AfterInsertRecord and put that in a new XBasic function.

    2. Create a JS Function (or even JS Action) that does an AJAX callback with chunked responses enabled on this function.

    3. Have your AfterInsertRecord function return JS code that invokes the JS function/action you created in Step 2.

    I’d have to double check this in morning though!


      I sent in an enhancement request and Selwyn suggested basically the same thing. The ajax coding inside the afterinsert record is different from a regular xbasic call (for instance, the e pointer contains different values), but I'll work it out.


        That's unfortunate but makes sense. On the plus side, given you can return JavaScript to the AfterInsertRecord function, at least you know it's still possible to do chunked responses for this event. It'd be nice if the chunked responses could be baked into the Server-Side events for times you'd want to use chunked responses in let's say the CanInsertRecord event. You wouldn't be able to return the JS until after the function finishes execution so by then it'd be too late to set CanInsertRecord.Cancel to .t. in the chunked response logic.

        Anyways! If you need more help with getting the AfterInsertRecord event to return the JS that does an AJAX call to the XBasic function that has chunked responses enabled (what a mouthful, haha), please shoot me a DM!


          I'm going to take you up on your offer. I don't see how to get it to fire any javascript. That is not what the afterrecordinsert function does so far as I can tell. (See the function prototype below.)

          What am I missing?

          function afterRecordInsert as v (e as p)
          'This function is called for the afterRecordInsert event.
          'The e object that is passed in contains the following data:
          ' e.tmpl = pointer to the component definition
          ' e.rtc = 'RuntimeCalculationObject' - allows you to pass data from one event handler to the next
          ' e.connection = SQL::Connection object with connection to database.
          ' e.sqlInsert = SQL command that was be executed to insert the record
          ' e.sqlArgs = Arguments for the sql command
          ' e.section = Section number. Top level of dialog is section 1. Each repeating section is a different section.
          ' e.aliasNumber = Alias number. Each section of the Dialog can be bound to multiple tables (connected in one-to-one links)
          ' e.alias = Name of current alias
          ' e.affectedRowCount = affectedRowCount
          ' e.primaryKeyOfInsertedRecord = if the primary key in an auto-increment value, value of the primary key
          ' e.row = if in a Repeating Section, the physical row number of the repeating section row.
          'Your event handler can set these two properties:
          ' e.rtc.abort = causes the entire update operation to abort. If transactions are turned on, the transaction is rolled back.
          ' e.rtc.AbortReason = reason to display for aborting the action
          end function


            Hmm, where is that event coming from? The original post mentions the "AfterInsertRecord", which is a Server-side Event found in Grid components. That event allows you to return JavaScript and provides this example:

            'To send a Javascript command to the browser, make an entry in this array.
            ' dim aa as p
            ' aa = e.rtc.A_AjaxResponses
            ' aa[].text = "alert('Message');"
            ' aa[..].id = 100 'the order in which the Ajax responses are sent to the browser
            Is this an event for a List control or something like that?

            EDIT: Just re-read the Original Post and saw where I was confused. You mentioned this is being called in afterDialogValidate. I'll take a look at this here shortly and see if it's possible! Sorry for the confusion!


              I just took a look at the function but you're right, I'm not seeing any way to return JS in that function. I'm not sure if this would work or not for you, but I did a test case and I can say for certain that the AfterRecordInsert event ran before I returned my JS. This is a little hacky so if someone has a better solution, please feel free to hop in haha.

              1. Add a hidden control to your UX. This control is going to hold data you need to return to your JS from the AfterRecordInsert event. In my test case, I made a hidden textbox control of character type called "recordWasInserted".
              2. In your AfterRecordInsert XBasic function, set e.dataSubmitted.<Control Name> with <Control Name> being the control you made in step 1. In my test case, I set e.dataSubmitted.recordWasInserted = "true".
              3. Now, in your afterDialogValidate Server-side function, use e.javascript and use {dialog.object}.getValue() to get the value of the control that was set in the AfterRecordInsert event. In my test case, I just did const wasRan = {dialog.object}.getValue('recordWasInserted'); if(wasRan) alert('JavaScript ran after the event');


                Yea, I was figuring I might have to do something like that. Just hate to work around things like that...

                Thank you!


                  FYI for anyone watching this thread.

                  Selwyn has added to the latest build the ability to send javascript code back to the browser after an event is fired from a serverside xbasic function on a UX.

                  e.rtc.javascript = "alert('test');"

                  It is also documented in the help.

                  This will be available on builds after today. (5/17/22)

                  So you still won't be able to do a chunked response during a server side event, but you can trigger a regular xbasic function after the event completes to enable chunked responses.