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

List data JSON formatting error

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

    List data JSON formatting error

    I'm getting a regular error submitting a list's data as JSON, and wonder if anyone has a suggestion for a solution:

    The list is initially defined with static data including this:

    Code:
    [{......."Acquisition_Date" : "06/05/2017",.....}]
    The list is populated from its detail view, including a control named Acquisition_Date that is defined as a date type.

    The population from the detail controls to the list is the standard:

    Code:
    var listObj = {dialog.object}.getControl('LIST1');
    listObj.updateListFromUXControls();
    When the user is ready for a final "Submit" I'm sending it to a callback for processing, again with the standard:

    Code:
    var listData = {dialog.object}.getListData('LIST1');
    var jsonDataStr = JSON.stringify(listData);
    var _dataToSubmit = A5.ajax.buildURLParam('__Data',jsonDataStr);
    {dialog.Object}.ajaxCallback('','','Save','',_dataToSubmit);
    and the callback begins with:

    Code:
    dim arr as p
    arr = json_parse(e.__data)
    All of this works nearly all the time. But there's often a frequent error with json_parse(). So I've been saving the e.__data before it gets to the json_parse() function and found this:

    Code:
    . . . "Acquisition_Date":"11/14/2"0"18 ", . . .
    The example I'm working has three records being submitted in e.__data and all three have exactly the same problem.

    I tried a client-side Transform Data Type in the list for this field, but that returned far more than just this date no matter what I did.

    So I'm not sure how to solve this.

    Anyone have an idea?

    Thanks.
    -Steve
    sigpic

    #2
    Re: List data JSON formatting error

    Hey Steve i have tested this and not getting an issue like you explain above.
    What value are you getting in javascript chrome debugger console for _dataToSubmit
    Simply console.log(_dataToSubmit) in your javascript code will give you the value in the chrome debugger console.
    Last edited by alexc; 01-17-2019, 12:02 AM.
    Alex Collier

    "The spread of computers and the Internet will put jobs in two categories. People who tell computers what to do, and people who are told by computers what to do"

    AA Builds from 5221_5152 to Pre-releases >> Deploying to IIS in AWS

    Comment


      #3
      Re: List data JSON formatting error

      The Alpha version/build you're using is required information. Any release or pre-release could introduce errors... with any release following correcting issues.

      Also, how is your Acquisition_Date input?
      Last edited by Davidk; 01-17-2019, 12:27 AM.

      Comment


        #4
        Re: List data JSON formatting error

        Thanks Alex. I can't reliably reproduce this enough to do what you suggest. I finally identified the problem by saving e.__data to my debugging table as the first action in the callback, and then relying on a user to tell me when it happened so I could go find one with an error. This happens maybe only once every 50 times or so on average; it's not something I'm likely to nail with the console.
        -Steve
        sigpic

        Comment


          #5
          Re: List data JSON formatting error

          Hey Steve,

          Could i suggest you also log client side js variables jsonDataStr and _dataToSubmit via a globalobj like {dialog.object}.__UnquieName.
          where you are generating the code from the server post the action something like

          Code:
          DIM uniquelink = _something 'Could make it so you can associate with log in db
          Code:
          js = <<text%
          js = js + "var listData = {dialog.object}.getListData('LIST1');"
          js = js + "var jsonDataStr = JSON.stringify(listData);"
          js = js + "var _dataToSubmit = A5.ajax.buildURLParam('__Data',jsonDataStr);"
          js = js + "{dialog.object}.__" + uniquelink + ".jsonDataStr = jsonDataStr;"
          js = js + "{dialog.object}.__" + uniquelink + "._dataToSubmit = _dataToSubmit ;"
          Alex Collier

          "The spread of computers and the Internet will put jobs in two categories. People who tell computers what to do, and people who are told by computers what to do"

          AA Builds from 5221_5152 to Pre-releases >> Deploying to IIS in AWS

          Comment


            #6
            Re: List data JSON formatting error

            So, as it appears the overall issue is that sometimes you get extra quotes in your date string? If that is true then you need to create a function to check each submitted value and make sure it's not including any non valid characters within the string. Maybe the users in some cases are inputting the date manually rather than using a date picker....I don't know. Definitely add the function to check each value before adding it to the submission.

            Comment


              #7
              Re: List data JSON formatting error

              Try this...

              Code:
              var listData = {dialog.object}.getListData('LIST1');
              var jsonDataStr = JSON.stringify(listData);
              [COLOR="#FF0000"]jsonDataStr = encodeURIComponent(jsonDataStr);[/COLOR]
              var _dataToSubmit = A5.ajax.buildURLParam('__Data',jsonDataStr);
              {dialog.Object}.ajaxCallback('','','Save','',_dataToSubmit);
              call back...

              Code:
              dim arr as p
              arr = json_parse([COLOR="#FF0000"]urldecode(e.__data)[/COLOR])
              I've made it a standard practice of mine to encode the data in situations like yours. It handles the special characters that might be bombing your callback.

              https://www.w3schools.com/jsref/jsre...icomponent.asp

              https://documentation.alphasoftware....20Function.xml
              Mike Brown - Contact Me
              Programmatic Technologies, LLC
              Programmatic-Technologies.com
              Independent Developer & Consultant​​

              Comment


                #8
                Re: List data JSON formatting error

                The A5.ajax.buildURLParam() method includes url encoding. The data is automatically decoded on the server side.

                Since this is a random issue, there's something else going on that's not been reported. We don't know what build/version is being used so we can't use that information to test and narrow the search. We also don't know how the date data is being input.

                My tests show no issues.
                Last edited by Davidk; 01-17-2019, 12:18 PM.

                Comment


                  #9
                  Re: List data JSON formatting error

                  Originally posted by Davidk View Post
                  The A5.ajax.buildURLParam() method includes url encoding.
                  oh ... Then nevermind.
                  Mike Brown - Contact Me
                  Programmatic Technologies, LLC
                  Programmatic-Technologies.com
                  Independent Developer & Consultant​​

                  Comment


                    #10
                    Re: List data JSON formatting error

                    Originally posted by WebDesignShop View Post
                    So, as it appears the overall issue is that sometimes you get extra quotes in your date string? If that is true then you need to create a function to check each submitted value and make sure it's not including any non valid characters within the string. Maybe the users in some cases are inputting the date manually rather than using a date picker....I don't know. Definitely add the function to check each value before adding it to the submission.
                    Users are forced to choose from the date picker, and several users from different countries have reported this. Thanks.
                    -Steve
                    sigpic

                    Comment


                      #11
                      Re: List data JSON formatting error

                      Steve,
                      I wonder if you could instead use e.dataSubmittedJSON? (https://documentation.alphasoftware....bmitted%20json

                      I know it looks like the problem is with the date field, but I'm not convinced about that.
                      I think there is a quoting issue going on with a text field that occurs before the date field and the "A5.ajax.buildURLParam()" doesn't know how to handle it because it expects JSON.stringify() to have done its job properly: https://github.com/gatling/gatling/issues/3296

                      Comment


                        #12
                        Re: List data JSON formatting error

                        Well, I've changed nothing and users are no longer reporting the error. Yesterday it officially got checked off the bug list.

                        Appreciate help all around, but right now I'm off to other fires. Wish I had an explanation but I don't.
                        -Steve
                        sigpic

                        Comment

                        Working...
                        X