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

DropDown List X 20 on Details View X 2.5K Items - Long Load

  • Filter
  • Time
  • Show
Clear All
new posts

  • DropDown List X 20 on Details View X 2.5K Items - Long Load

    So was wondering if there is a way to optimise the DropDown List

    I have in a View 20 DropDown that contain the exact same MySQL Query (for populating the list). Having just 1 of those showed works really fast. But having the 20 of them showed takes about 30 secs to load the form. So my guess it's running the MySQL query 20 times.

    Pretty sure there is a way to load the data once and then affect the drop down list with the loaded data?


  • #2
    Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

    It sounds like you're using a defined SQL statement in each dropdown control? If so, then yes, you can do this once, re-use many times.

    Look at the way you can define choices in the control. The choice you want is the "Variable" choice.

    Then, execute some SQL in the OnDialogInitialize event to create e.rtc.MyVariableName

    Here's an example:

    dim cn as sql::connection
    dim rs as sql::resultset"::name::conn")
    sql = <<%a%
    FROM vw_Medical_TherapyPlan_Animals
    order by type
    rs = cn.ResultSet
    typeList = rs.toString()
    e.rtc.Type_list = "All" + crlf() + typeList
    Then, in this case, set the Variable name in the dropdown control to "Type_List" (without the quotes).

    Of course the question also should be considered as to why you have 20 identical dropdown lists but I'm sure you have good reason.


    • #3
      Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

      Originally posted by Steve Workings View Post
      Of course the question also should be considered as to why you have 20 identical dropdown lists but I'm sure you have good reason.
      Its for crafting recipe. So item1 + item2 + item3 (16 times) = result1 + results2 (4 times) -> All the items that can be use or craft are from an other table in the DB.

      Ok so never did anything like this before (Guess I need to get into that now) So I use a Grid, I looked in the Server-side Events and Client-side Events and can't find the OnDialogInitialize (Could it be OnGridInitialize) ?

      Also I show the Name (in the table) but need to put the ID; would this still work?

      Example of my DropDown = SELECT DISTINCT name, id FROM item_templates WHERE isActive=1 ORDER BY name, id


      • #4
        Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

        Yes, use the OnGridInitialize event in the grid.

        And to display one value, but store another, your query is:

        SELECT DISTINCT concat(Name, '|', ID)
        FROM item_templates 
        WHERE isActive=1 
        ORDER BY name, id
        This is MSSQL syntax with the concat() function -- I'd have to check that it's the correct function for MySQL.


        • #5
          Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

          Must be missing something, tried something without concat (should work in MySQL)

          dim cn as sql::connection
          dim rs as sql::resultset
          sql = <<%a%
          SELECT DISTINCT id FROM item_templates WHERE isActive=1 ORDER BY id
          rs = cn.ResultSet
          item_Templates = rs.toString()
          e.rtc.Item_Templates_List = "All" + crlf() + item_Templates

          Using Item_Templates_List in the variable and its showing nothing?

          Also not to sure how to input code in the forum?


          • #6
            Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

            So found out how to use the XBasic debugger (Sorry still really new at this). I have added the debug(1) - debug (0) to the script. When I hover over the e.rtc.Item_Templates_List I have the full list of what I need (changed it to be e.rtc.Item_Templates_List = "-1|-1" + crlf() + typeList.

            In the DropDown I use the variable Item_Templates_List but the dropdown is empty


            • #7
              Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

              Made it work by using the Choice Variable in the Drop Down; using the DataSource type Variable does not seem to work (see pictures) Anyone knows the difference?


              • #8
                Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

                Ok did the test and the speeds are the same (about 25 seconds to open the window) and that's on every links. Guess it's when AA tries to parse the DropDownList?


                • #9
                  Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

                  And you've changed all your dropdowns to use the Variable method?

                  How long is the list in a dropdown?

                  It may be appropriate to consider some other design -- finding yourself with 20 identical dropdowns could be an indication of this.


                  • #10
                    Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

                    Hi Steve,

                    Each Drop Down List contains 2500 items. Attached is a picture. I thought I could maybe do a list (with all the items) and allow drag and drop on each place, since all of those have Icons and then do a lookup; but thats kind of advance for me for now but might do the trick.




                    • #11
                      Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

                      Yeah, that's not going to work very well. 2500 lines x 20 controls = 50,000 lines to deliver to the browser - and that's just for the dropdowns. It'll be worse if any of your users have a slower connection than you.

                      I'd like to suggest what you should be doing instead, but am wary of taking that path without a decent understanding of what you're doing.

                      You could try some other controls such as auto-suggest lookup that doesn't start by loading all those values 20 times. Test this by configuring one or two and seeing if you think that will work from the user's standpoint.

                      And while the grids are useful workhorses, I generally counsel to look for a UX-based solution if possible -- it simply offers newer, more, better, faster tools than the grid -- it's a longer-term solution where you might eventually end up anyway.


                      • #12
                        Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

                        I wouldn't attempt delivering repetitive data from a server to a client. I would try letting the client do the work.

                        Populate one dropdown and then, when the component is rendered, harvest that dropdown putting the data into an array. Then use the {grid.Object}.populateDropdownBox() method to load the other dropdowns.

                        If there's a reason not to load all dropdowns upon render... even better. Do they all need to be available at the same time?


                        • #13
                          Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

                          I am actually doing something clientside with no visit to the server. I want to populate dropdowns for all permitted choices.

                          I use JavaScript (didn't check to see if Alpha had a method.)

                          var select = {dialog.Object}.getPointer('dropDown');
                          // this line clears choices if they exist.
                          select.options.length = 0;
                          // these lines add choices
                          select.add(new Option("one", 1));
                          select.add(new Option("two", 2));
                          select.add(new Option("three", 3));


                          • #14
                            Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

                            I don't think I'd want to perform a select.add 2500 times... X 20. Plus Jean is using a Grid.

                            You could, in XBasic, build your dropdown data array and assigned it to a state variable. Your data array would end up looking like this in XBasic...

                            "[['alpha 2','A2'],['beta 2','B2'],['display for c','C2']]"
                            And then you'd assign that "string array" to a state variable in XBasic...

                            e._state.myddData = "[['alpha 2','A2'],['beta 2','B2'],['display for c','C2']]"
                            In the grid, in client-side onRenderComplete you could then do something like this...

                            var stateInfo = {Grid.Object}.getStateInfo();
                            //the stateInfo is & delimited so we need to split it up into an array
                            var stateArray = stateInfo.split("&");
                            //now we need to find our state variable
                            var search = "myddData";
                            var found = null;
                            for (var i = 0; i < stateArray.length; i++) {
                              if (stateArray[i].indexOf(search) > -1) {
                                found = stateArray[i];
                            //we found are state variable.  Split it up into its own array
                            var stateArray = found.split("=");
                            var arrayStr = stateArray[1];
                            //we built the string array of data using single quotes... which is easy for XBasic but JSON doesn't like it very much.  Convert single to double quotes.
                            var arrayStr = arrayStr.replace(/'/g, '"');
                            //now we have a properly formatted JSON string.  Parse it into a proper JS array for use in the populate method.
                            myDDData = JSON.parse(arrayStr);
                            Lots to worry about doing this. Does your dropdown data include single quotes? How will the grid handle a state variable of the size you're proposing? How fast will the populate method work with an array of that size?

                            Doing this, you don't have to set up even one dropdown in the normal way. Just use the Static option for all dropdowns you plan to populate
                            Last edited by Davidk; 09-13-2016, 11:59 AM.


                            • #15
                              Re: DropDown List X 20 on Details View X 2.5K Items - Long Load

                              David, we had a discussion about my 6,500 lines of wine.

                              Is a dropdown with 2500 useable?

                              What about lookup using a grid or list with a search?