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

JSON Field Display UX List Control MySQL

  • Filter
  • Time
  • Show
Clear All
new posts

  • JSON Field Display UX List Control MySQL

    I have a simple UX Control where I want to display a list of projects and contact details. I would like the contact details to be a JSON object so that I can save it to a MySQL table.

    I have created a List Control named Projects

    I have created a spreadsheet control

  • #2
    Re: JSON Field Display UX List Control MySQL

    I think there's a question in here... but not sure.

    1. You want to save the JSON definition, in a MySQL field, for feeding a Spreadsheet control.
    2. You want to get that JSON, fill it with Contact Details data, and send it on to the SpreadSheet Control

    So... you've got a List Control for Projects. You click on a Project and then perform an Ajax Callback to get the JSON definition, fill it with data, and return it do the Spreadsheet control.

    Any of this right?


    • #3
      Re: JSON Field Display UX List Control MySQL

      Hi David and Group

      I thought I was still editing that post... Ha...

      So to finish... I want to effectively:
      1. Read and write JSON from a spreadsheet control to a JSON feild in MySQL
      2. Be able to setup a complex spreadsheet control to do complex parameters for an inventory part.

      Ok I get what I need to change to populate the spreadsheet. My resultset is toString() not toJson()
      --- See my notes below ---

      BUT HOW do I now submit, when the spreadsheet columns are bound
      to individual fields?

      Ok so I am just using a simple table with two fields:

      --- Name as a VarChar(255)
      --- Details as a TEXT or JSON

      The "Smith Family" in Name field and then the JSON statement in the Details:

      {"Name" : "Bob Smith", "Phone" : "123-123-1234", "Type" : "POC"}, 
      {"Name" : "Linda Smith", "Phone" : "123-123-1234", "Type" : ""},
      {"Name" : "Glenda Amazing", "Phone" : "123-123-1234", "Type" : "Designer"}
      The example from the Alpha Release Notes reads this from standard SQL fields in a result set, "Name", "Phone", "Type".
      In figuring out how this works I am looking at how the spreadsheet data is populated from a
      SQL query and its result set.

      ====== OK here is the results set ======

      Button to populate
      {dialog.object}.ajaxCallback('','','xb','','',{deviceOfflineFunction: function() {   }});
      ====== From my XB Function ======

      cn.Execute("select * from contacts)
      dim json as c 
      json = cn.ResultSet.toJson()
      ====== This is the ResultSet.toJson =========
      ====== SO FOR A JSON Field I use ResultSet.toString() that was easy! ======
      {"Name": "Bob Smith", "Phone": "123-123-1234", Type: "POC"}, 
      {"Name": "Linda Smith", "Phone": "123-123-1234", Type: ""},
      {"Name": "Glenda Amazing", "Phone": "123-123-1234", Type: "Designer"}
      ====== then the stritran() ========
      json = stritran(json,crlf()," ") Take the carriage return after and before the [ ] brackets and comma
      seperating the lines so that we have one string.

      [ {"Name": "Bob Smith", "Phone": "123-123-1234", Type: "POC"},{"Name": "Linda Smith", "Phone": "123-123-1234", Type: ""},{"Name": "Glenda Amazing", "Phone": "123-123-1234", Type: "Designer"} ]
      ====== then add var _d = infront of the json string and semicolon and cariage return line feed after. ====

      js = "var _d = " + json + ";" + crlf()
      var _d = [ {"Name": "Bob Smith", "Phone": "123-123-1234", Type: "POC"},{"Name": "Linda Smith", "Phone": "123-123-1234", Type: ""},{"Name": "Glenda Amazing", "Phone": "123-123-1234", Type: "Designer"} ];
      ====== then create the javascript to execute =========

      js = "var _d = " + json + ";" + crlf()
      js = js + "var _data = JSON.stringify(_d); {dialog.object}.setValue('ss1',_data);
      var _d = [ {"Name": "Bob Smith", "Phone": "123-123-1234", Type: "POC"},{"Name": "Linda Smith", "Phone": "123-123-1234", Type: ""},{"Name": "Glenda Amazing", "Phone": "123-123-1234", Type: "Designer"} ];
      var _data = JSON.stringify(_d);
      {dialog.object}.setValue('ss1',_data);  //ss1 is the spreadsheet control
      It works!!!

      But now how to submit changes....?


      • #4
        Re: JSON Field Display UX List Control MySQL

        You don't really need to do some of what you're doing... and I prefer to call a Javascript function for some of it as well. It seems less messy on the XBasic side.

        This will send the JSON to the client and fire off a Javascript function name loadSSDemoData. The only real difference is that you don't have to stringify the JSON.

        rs = cn.ResultSet
        jsonData = rs.toJSON();
        dim returnData as c
        returnData = "var demoData = " + jsonData + "loadSSDemoData(demoData);"
        getssDemoData = returnData
        The Javascript function is...

        function loadSSDemoData(demoData){
        	var obj = {dialog.object}.getControl('ss1');
        When you submit your UX, all the data from the SpreadSheetControl will be in e.dataSubmitted.SS1

        You'll then parse that JSON into whatever you need to perform your updates. The spreadsheet columns aren't really bound to individual fields. Their data came from tables fields, parsed into JSON and fed into the control... but there's no field binding.

        It's... Select --> parse --> populate --> submit --> parse --> update.