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

How to pass a UX control value to Xbasic charting routine

  • Filter
  • Time
  • Show
Clear All
new posts

    How to pass a UX control value to Xbasic charting routine

    I wonder if anyone can point me in the right direction with the following:


    Two UX panels, one with a list of accounts, another with a chart control (which is supposed to chart expenditure, burn-rate, etc. data for an account selected in panel 1)

    Selecting an account in panel 1 activates panel 2, which has the (native) chart


    I have managed to update a label in panel 2, showing which account was selected in the list in panel 1.

    I can't figure out how to orchestrate the chart refresh so that it filters the list on the selected account number. I've tried calling active javascript and passing the selected account number to the chart Xbasic routine, but the problem with that approach is that teh active javascript cannot refresh the chart using the Xbasic chart data return value, because chart, apparently, doesn't support the setvalue -method. I tried running active javascript something like this:

    var chartValue = {dialog.object}.ajaxCallback('','','getMonthlyAccountExpenditures','','_var='+AccountNumber,{deviceOfflineFunction: function() {   }});
    where getMonthlyAccountExpenditures is the Xbasic code that queries the database and returns a pipe-delimited string, and MonthlyAccountExpenditures is the name of the chart variable. The setvalue method returned error that the object doesn't support setvalue, so I'm stuck.

    I guess the question really boils down to this: Is there any way to insert a value directly into a chart's Field Properties/Variable name and refresh the chart without triggering another trip to the Xbasic code, all this using javascript?

    I may have to try Google graph instead, maybe it is more approachable...

    Re: How to pass a UX control value to Xbasic charting routine

    There are so many variables here. There is probably a simple answer, but a simple sample UX showing a sample chart would be helpful.

    You can't call an Xbasic function with an Ajax Callback like that. The Xbasic function 'getMonthlyAccountExpenditures' will return Javascript in 'getMonthlyAccountExpenditures'. Set getMonthlyAccountExpenditures to Javascript statements or a Javascript function...

    function getMonthlyAccountExpenditures as c (e as p)
    ''''your XBasic code...
    getMonthlyAccountExpenditures = "{dialog.object}.setvalue('MonthlyAccountExpenditures','" + chartValue + "');"
    end function


      Re: How to pass a UX control value to Xbasic charting routine

      Thank (as always) you for your response.

      I have tried what you suggested, understanding how action javascript works. However, I may not have explained the problem very clearly.

      You probably know this already, but when using charts, every time a chart is refreshed some Xbasic code runs to get and format the data for the time series (in this case my getMonthlyAccountExpenditures() does all that.) That works fine since apparently in the background the refresh method of the chart makes a specific call to that routine. However, when the Xbasic code runs through active javascript, the code needs to return a javascript statement. So far so good, I've done exactly that (like you showed in your example.) However, the returned javascript statement cannot refresh the data in the chart directly with setvalue(), because the chart component doesn't support that function. The only way (as far as I can tell) to refresh the chart data can be done from refresh() or other events, which then run the Xbasic function that doesn't receive the filter value (in my case Account number.)

      My other option would be to use a session variable to store the selected account number and grab it in the Xbasic code, but that approach seems to be frowned upon, if I understand correctly some discussions around that technique. Ideally, this type of messaging between the UI (javascript) and the server (Xbasis) is all done using active javascript.


        Re: How to pass a UX control value to Xbasic charting routine

        Meh... I'm moving on to Google charts... Which I probably should have done a while ago already.

        Based on the Alpha videos on Google charts it seems to me that it is relatively easy to send a filter value to the server when refreshing the chart data and the chart itself. But, of course, seeing is believing.


          Re: How to pass a UX control value to Xbasic charting routine

          As you already have the chart details in your list - pass those values to the Google chart and draw it.
          Insanity: doing the same thing over and over again and expecting different results.
          Albert Einstein, (attributed)
          US (German-born) physicist (1879 - 1955)


            Re: How to pass a UX control value to Xbasic charting routine

            Here is one my posts that has an example of using Google charts with Northwind SQL database. I have used Google charts extensively with good results. Hope this helps.


              Re: How to pass a UX control value to Xbasic charting routine

              Thank you for the link! In the meanwhile, I have successfully implemented Google charts for my application, including dynamically refreshed content from SQL server. Regardless, your posting included some great ideas, such as a placeholder for no data.

              While struggling through yet another Alpha thicket, I've had some recurring thoughts about effective and non-effective documentation. While Selwyn's videos are very well done and informative, they are still videos. Videos are good for getting a quick overview of a topic, but they are not all that helpful when trying to build your own app using the techniques covered in the video. You can't copy code, you can't re-read difficult concepts easily, small but critical details are too easy to miss, searching for certain details in a video is extremely time-consuming. Maybe it's just my learning style, but I often find videos more frustrating than helpful.

              As for charts, you can choose between "native" charts, Google charts, and Javascript charts. Nowhere did I see a good comparison of the three charts, so I had to learn it the hard way. I started with native charts but realized soon that they are very difficult to use in a dynamic way (refreshing with new content,) at least without resorting to session variables. Maybe there is a way to do that, but I didn't see any examples or mentions of how to do it. I moved on to Javascript charts because they are the most recent addition to Alpha and thus I expected them to be most advanced as well. I soon learned that customizing them is frustratingly limited (such as adding y-axis titles or rotating x-axis labels.) I can see all kinds of optional settings in the charting platform they are based on, but Alpha seems to turn a blind eye to most of them (i.e., they have no effect.) The major buzz-killer for me was the inability to rotate x-axis labels, which means that labels longer than 1-2 characters overlap each other and render the graph practically useless. Finally, I moved on to Google charts, which seem very well designed, adjust automatically to available screen space, and allow for all kinds of customization. Most of this happens outside of Alpha's control, but at least Alpha allows you to tap directly into Google charts' native APIs

              Finally, the way the documentation is written for this and many other Alpha topics reminds me of a construction process where you are given a picture of the final building and an explanation of the necessary techniques to do the construction, but blueprints are very few and far between. For example, it would be great if charts -related documentation had a section right up front explaining on a high, conceptual level how everything goes together and what the interdependencies are. I've complained about Alpha's documentation in the past, and while it is much improved from just a few years ago, it still has a long way to go, in my humble opinion. It might be a good idea to hire a consultant or a full-time person who has been trained specifically on writing efficient documentation. It is an art in itself, and engineers are generally notoriously unprepared to do a good job at it.

              Be that as it may, I now have a good looking mobile app with charts, working exactly as I want it to work. So, there's that :-)


                Re: How to pass a UX control value to Xbasic charting routine

                Hello pertti!

                We do have a full time documentation person here at Alpha. If you find an issue with documentation or have suggestions for ways to improve our articles, you can use the link at the bottom of any article to send us feedback. Our documentation team will be more than happy to have your feedback.

                Thank you!
                Sarah Mitchell
                Director of Customer Success | [URL=""]Alpha Software Corporation[/URL]
                [B]Get in the know! [/B] Join us for our Weekly Webinars: [URL=""]TransForm Tuesday[/URL] and [URL=""]Wednesday's Alpha Anywhere Demo and Q&A[/URL]
                Connect with us: [URL=""]Instagram[/URL] | [URL=""]Twitter[/URL] | [URL=""]Facebook[/URL] | [URL=""]LinkedIn[/URL] | [URL=""]YouTube[/URL]


                  Re: How to pass a UX control value to Xbasic charting routine

                  There is no problem using all features of Rgraph in Alpha. The only slight problem is you don't use the builders but you can still use Alpha to get and filter the base data.


                    Re: How to pass a UX control value to Xbasic charting routine

                    I had success with the Rgfaph, but the constraint of using a UX Data Series as the default source rather than the List or vBox controls and the absence of a legend control alienated it from my UX data already in play.
                    Insanity: doing the same thing over and over again and expecting different results.
                    Albert Einstein, (attributed)
                    US (German-born) physicist (1879 - 1955)