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

Help with xBasic. Google Geochart

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

  • Help with xBasic. Google Geochart

    I have built a chart that shows the US states.

    I can populate it with data from a database.

    So I can set the tooltip to show the name of the state and the representative for that state. I have an onclick event that allows me to get a pointer to the state.

    Google Geochart.png

    Selwyn has a video that shows how to pass the array to onDialogueInitalize

    dim js as c
    js = "{dialog.object}._data = " + txt + ";"

    e.javascript = js

    I want to run a second SQL statement to build a second array.

    In the help it shows some help for building an array to populate multiple rows in the repeating section.

    Here is the Javascript I would like to populate from the database.

    var _d = {dialog.object}._data; this I have passed in but I would also like to pass in height, width and colour.

    var wide = wide;
    var high = high;
    var colour = ['#FFA000', '#FFECB3', '#FFECB3', '#FFECB3', '#FFA000', '#607D8B', '#BDBDBD', '#BDBDBD', '#BDBDBD', '#BDBDBD', '#FFA000', '#607D8B', '#607D8B', '#607D8B', '#607D8B', '#607D8B', '#607D8B', '#FFECB3', '#BDBDBD', '#BDBDBD', '#BDBDBD', '#607D8B', '#607D8B', '#FFECB3', '#FFECB3', '#607D8B', '#BDBDBD', '#607D8B', '#607D8B', '#BDBDBD', '#BDBDBD', '#FFECB3', '#FFA000', '#BDBDBD', '#607D8B', '#607D8B', '#FFA000', '#BDBDBD', '#BDBDBD', '#BDBDBD', '#607D8B', '#607D8B', '#FFECB3', '#607D8B', '#BDBDBD', '#BDBDBD', '#FFA000', '#607D8B', '#607D8B', '#607D8B',];

  • #2
    Re: Help with xBasic. Google Geochart

    So here is the full code.

    dim sql as c
    sql = <<%txt%
    SELECT
    states.State AS State,
    states.Area AS Area,
    states.Representive AS Representitive,
    states.`value` AS `value`,
    states.format AS format
    from `states`

    %txt%

    dim cn as sql::Connection
    cn.open("::Name::MySQL_Test")
    dim flag as l
    flag = cn.Execute(sql)
    dim rs as sql::ResultSet
    rs = cn.ResultSet
    dim template as c

    'debug(1)

    template = "[{v:'{js_escape(ds.data("value"))}', f:'{ds.data("format")}'},{v:{ds.data("State")}, f:'Region:- {ds.data("Area")} - | - Representive:- {ds.data("Representitive")} '} ],"


    dim txt as c
    txt = a5_mergedataintotemplate(template,rs)

    dim wrap as c
    wrap = "[['State','State details'],"
    txt = wrap + txt + "]"

    dim js as c
    js = "{dialog.object}._data = " + txt + ";"

    So here I would like to run a SQL statement like the above and then pass multiple variables to e.javascript


    e.javascript = js

    Comment


    • #3
      Re: Help with xBasic. Google Geochart

      i do not know the extent or context of what you are doing. when you want to pass a command to be executed in the browser just send a string to e.javascript like e.javascript = e.javascript + "alert('hello michael');"
      so
      Code:
      dim msg as c = ""
      msg = msg + "var wide = "  + wide + ";"
      msg = msg + "var high = "  + high + ";"
      msg = msg +  "var colour = ['#FFA000',	'#FFECB3',	'#FFECB3',	'#FFECB3',	'#FFA000',	'#607D8B',	'#BDBDBD',	'#BDBDBD',	'#BDBDBD', '#BDBDBD',	'#FFA000',	'#607D8B',	'#607D8B',	'#607D8B',	'#607D8B',	'#607D8B',	'#607D8B',	'#FFECB3',	'#BDBDBD', '#BDBDBD',	'#BDBDBD',	'#607D8B',	'#607D8B',	'#FFECB3',	'#FFECB3',	'#607D8B',	'#BDBDBD',	'#607D8B',	'#607D8B', '#BDBDBD',	'#BDBDBD',	'#FFECB3',	'#FFA000',	'#BDBDBD',	'#607D8B',	'#607D8B',	'#FFA000',	'#BDBDBD',	'#BDBDBD', '#BDBDBD',	'#607D8B',	'#607D8B',	'#FFECB3',	'#607D8B',	'#BDBDBD',	'#BDBDBD',	'#FFA000',	'#607D8B',	'#607D8B', '#607D8B',];"
      then add to the txt
      txt = txt + msg
      e.javascript = txt

      i think that should be good, at least i am guessing.
      ( or simply replace txt for msg in the above
      like txt = txt + "var wide = " + wide +";" )
      edit:
      since these are javascript variables you want to pass i am not sure you need to wrap them in "<script" "</script>"
      Last edited by GGandhi; 01-30-2017, 05:45 AM.
      thanks for reading

      gandhi

      version 11 3381 - 4096
      mysql backend
      http://www.alphawebprogramming.blogspot.com
      [email protected]
      Skype:[email protected]
      1 914 924 5171

      Comment


      • #4
        Re: Help with xBasic. Google Geochart

        Originally posted by GGandhi View Post
        i do not know the extent or context of what you are doing. when you want to pass a command to be executed in the browser just send a string to e.javascript like e.javascript = e.javascript + "alert('hello michael');"
        so
        Code:
        dim msg as c = ""
        msg = msg + "var wide = "  + wide + ";"
        msg = msg + "var high = "  + high + ";"
        msg = msg +  "var colour = ['#FFA000',	'#FFECB3',	'#FFECB3',	'#FFECB3',	'#FFA000',	'#607D8B',	'#BDBDBD',	'#BDBDBD',	'#BDBDBD', '#BDBDBD',	'#FFA000',	'#607D8B',	'#607D8B',	'#607D8B',	'#607D8B',	'#607D8B',	'#607D8B',	'#FFECB3',	'#BDBDBD', '#BDBDBD',	'#BDBDBD',	'#607D8B',	'#607D8B',	'#FFECB3',	'#FFECB3',	'#607D8B',	'#BDBDBD',	'#607D8B',	'#607D8B', '#BDBDBD',	'#BDBDBD',	'#FFECB3',	'#FFA000',	'#BDBDBD',	'#607D8B',	'#607D8B',	'#FFA000',	'#BDBDBD',	'#BDBDBD', '#BDBDBD',	'#607D8B',	'#607D8B',	'#FFECB3',	'#607D8B',	'#BDBDBD',	'#BDBDBD',	'#FFA000',	'#607D8B',	'#607D8B', '#607D8B',];"
        then add to the txt
        txt = txt + msg
        e.javascript = txt





        i think that should be good, at least i am guessing.
        ( or simply replace txt for msg in the above
        like txt = txt + "var wide = " + wide +";" )
        Thanks Ghandhi

        I need 2-4 variables to use in a javaScript chart function.


        So in the end js would give me

        {dialog.object}._data
        {dialog.object}._colour
        {dialog.object}._wide
        {dialog.object}._high

        Wide and high are not critical

        but data and colour are essential

        I have successfully built {dialog.object}._data it works seemlessly so I could change the name of a name of the rep. If the regions were reorganised and Arizona was moved into Western I want to change the colour rendered. At the moment that is the string of 50 colours hard coded.

        My problem is how and where to run the second database result set and how to construct e.javascript. I am sure this is simple but I am only copying Selwyn's code.

        Comment


        • #5
          Re: Help with xBasic. Google Geochart

          My problem is how and where to run the second database result set and how to construct e.javascript.
          since i do not have your geochart capabilities enabled in my version i won't know exactly how to build the other variables, but
          you run a single xbasic routine which will have any number of end points. each end points will yield one result and then you stitch them together to yield one string which will be executed in the browser. so in your case
          xbasic starts
          part1
          {dialog.object}._data is built and the end point will be txt1 = "{dialog.object}._data =" + the result obtained
          part2
          {dialog.object}._colour is built and the end point will be txt2 = "{dialog.object}._colour =" + the result obtained
          part3
          {dialog.object}._wide is built and the end point will be txt3 = "{dialog.object}._wide =" + the result obtained
          part4
          {dialog.object}._high is built and the end point will be txt4 = "{dialog.object}._high =" + the result obtained
          txt = txt1+txt2+txt3+txt4
          xbasic ends.

          e.javascript = txt

          incidentally michael, you inspired me to look into geochart capabilities. it is really good stuff and i learned i can actually work with that in my version. i will post a screencast on a separate thread, not to contaminate yours.
          good luck.
          thanks for reading

          gandhi

          version 11 3381 - 4096
          mysql backend
          http://www.alphawebprogramming.blogspot.com
          [email protected]
          Skype:[email protected]
          1 914 924 5171

          Comment


          • #6
            Re: Help with xBasic. Google Geochart

            Originally posted by GGandhi View Post
            since i do not have your geochart capabilities enabled in my version i won't know exactly how to build the other variables, but
            you run a single xbasic routine which will have any number of end points. each end points will yield one result and then you stitch them together to yield one string which will be executed in the browser. so in your case
            xbasic starts
            part1
            {dialog.object}._data is built and the end point will be txt1 = "{dialog.object}._data =" + the result obtained
            part2
            {dialog.object}._colour is built and the end point will be txt2 = "{dialog.object}._colour =" + the result obtained
            part3
            {dialog.object}._wide is built and the end point will be txt3 = "{dialog.object}._wide =" + the result obtained
            part4
            {dialog.object}._high is built and the end point will be txt4 = "{dialog.object}._high =" + the result obtained
            txt = txt1+txt2+txt3+txt4
            xbasic ends.

            e.javascript = txt

            incidentally michael, you inspired me to look into geochart capabilities. it is really good stuff and i learned i can actually work with that in my version. i will post a screencast on a separate thread, not to contaminate yours.
            good luck.

            Thanks I will give it a go. I have sent you an email with the code.

            Comment


            • #7
              Re: Help with xBasic. Google Geochart

              A big thank you to Ghandhi the colour now works

              'put the colour module here

              dim sql as c
              sql = <<%txt%
              SELECT
              states_regions_colours.Colour AS Colour
              from (`states` join `states_regions_colours` on((`states_regions_colours`.`Area` = `states`.`Area`)))
              order by `states`.`value`

              %txt%

              dim cn as sql::Connection
              cn.open("::Name::MySQL_Test")
              dim flag as l
              flag = cn.Execute(sql)
              dim rs as sql::ResultSet
              rs = cn.ResultSet
              template = "'{js_escape(ds.data("Colour"))}',"


              dim txt as c
              txt = a5_mergedataintotemplate(template,rs)



              txt = "[" + txt + "]"

              dim js2 as c
              js2 = "{dialog.object}._cdata = " + txt + ";"


              'end of colour

              e.javascript = js + js2

              Comment


              • #8
                Re: Help with xBasic. Google Geochart

                very good.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                • #9
                  Re: Help with xBasic. Google Geochart

                  would it be possible to post a sample output and the dialog?
                  thanks for reading

                  gandhi

                  version 11 3381 - 4096
                  mysql backend
                  http://www.alphawebprogramming.blogspot.com
                  [email protected]
                  Skype:[email protected]
                  1 914 924 5171

                  Comment


                  • #10
                    Re: Help with xBasic. Google Geochart

                    http://smg.datadrivensystems.co.uk/r.../dashboard.a5w

                    a messy sample.

                    Comment


                    • #11
                      Re: Help with xBasic. Google Geochart

                      very nice michael, and all javascript events are working perfect.
                      i would add instruction on the top saying "click on a state to see the stats and click on the item to see the detail". it is not evident when you see it.
                      but that would be helpful for people like me.
                      but really very good work.
                      thanks for reading

                      gandhi

                      version 11 3381 - 4096
                      mysql backend
                      http://www.alphawebprogramming.blogspot.com
                      [email protected]
                      Skype:[email protected]
                      1 914 924 5171

                      Comment


                      • #12
                        Re: Help with xBasic. Google Geochart

                        We are in the middle of building a webinar for Alpha so this dashboard will be used by the narrator. It is not part of a customer facing site.

                        It is used to illustrate the viewbox as a lightweight device,

                        If you look at this component it is just 55K

                        http://smg.datadrivensystems.co.uk/r..._template2.a5w


                        Or this one just 70K

                        http://smg.datadrivensystems.co.uk/d...login/test.a5w

                        There is no user help as they are building blocks to the webinar.

                        Comment


                        • #13
                          Re: Help with xBasic. Google Geochart

                          now that makes sense, very good indeed.
                          thanks for reading

                          gandhi

                          version 11 3381 - 4096
                          mysql backend
                          http://www.alphawebprogramming.blogspot.com
                          [email protected]
                          Skype:[email protected]
                          1 914 924 5171

                          Comment

                          Working...
                          X