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

2nd Attempt: UX lists and dropdownboxes

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

    2nd Attempt: UX lists and dropdownboxes

    I am registering a new thread as my original thread have no responses and/or interested parties without payments linked to it. Unfortunately i would gladly pay for assistance IF the price was not so high.

    I am therefore downgrading my request to the following;

    I need assistance in doing the following;

    I have two "persist to local" lists - List1 and List2

    I also have 2 dropdownboxes on a panel which requires the following cascading;
    Dropdown box 1 obtain its values from field1 in List1
    Dropdown box 2 obtain its values from field2 in List2 and need to be filtered based on the value chosen in dropdownbox 1

    Both lists have the same fields to do the filtering on i.e.
    List1 fields - fieldA, fieldB, fieldC and field1 [dropdown value, not primary keys]
    List2 fields - fieldA, fieldB, fieldC and field2 [dropdown value, not primary keys, to be filtered on fieldA, fieldB and fieldC of List1]

    If not to much to ask, any assistance on the above will provide me with a starting point at least because i have never done this before. Online it works great as it can see the SQL tables.

    Kind regards

    #2
    Re: 2nd Attempt: UX lists and dropdownboxes

    See if this helps.. You will need the latest pre-release. http://www.viddler.com/v/bbf8628f
    Insanity: doing the same thing over and over again and expecting different results.
    Albert Einstein, (attributed)
    US (German-born) physicist (1879 - 1955)

    Comment


      #3
      Re: 2nd Attempt: UX lists and dropdownboxes

      You can repopulate the choices in the DROPDOWN boxes by extracting the desired choices from the LISTS into arrays and then calling "A5.form.populateSelect(ElementID, SelectedValue, ChoiceArray, bClearExistingValues)". I'm thinking List2 contains all the possible choices for dropdown2 and at any given moment dropdown2 is only displaying a subset of records from list2 (the records that have a field value matching that from the selected record in DropDown1.) List1 contains all possible choices for dropdown1.

      You should NOT need a pre-release to accomplish this; I suspect the A5.form.populateSelect function has been in the A5 library for a long time.

      There are probably higher level functions you could use from the UX methods. Search the Video library for 'dropdown' and/or 'dynamic' for higher level methods that you can use.
      But this low level function will get the job done very efficiently and everything takes place in the browser.

      I don't know where to find documentation on the A5.form.populateSelect method. So, I will try to explain the parameters, which I have renamed with my own terminology for this example. The best thing to do is to use the browser's Developer Tools to step into this A5 library function and see what it does. Here's my explanation of the parameters:

      -ElementID: character string: This is the fully qualified ID used for the control like '{dialog.ComponentName}.V.R1.MyDropdown1'
      -SelectedValue: character string containing the StoredValue of the element in the list that should be initially selected. (Note: I haven't figured out how to not preselect a value; everything I have tried has ended up adding an extra, non-sense, choice into the list.
      -ChoiceArray: array[n][2] of display value and stored value pairs for 'n' number of items.
      -bClearExistingValues: Boolean: true = clear existing choices, false = keep existing choice and append new choices.

      Computing the 'ChoiceArray' is the tricky thing here. You want to end up with a two dimensional JavaScript array. The first dimension contains 'n' number of display / stored value pairs. The second dimension contains the display value [0] and the stored value[1]. So, an example array to pass to the function, using JavaScript object syntax would be:
      [ [ 'Alabama', 'AL'],
      ['Alaska','AK'],
      ['Arizona','AZ'],
      ['Arkansas','AR'],
      ['California','CA']
      ]

      I believe the function expects a stored value, if your stored value is the same as the display value then just duplicate the display value to the stored value slot [n][1].

      To create the array, use the JavaScript array methods '.filter()' and '.map()' or you could create the arrays in a 'for' loop using the array.push() method. The 'filter()' and 'map()' functions are difficult to explain, so I will just provide an example and you can search youtube for video explanations of these two higher-order functions. I took my working code and came up with the following example to demonstrate dynamically changing the choices in dropbox2. Sorry, if there are any mistakes in it.

      function refreshDropBox2( thisUX ) {
      var filterVal = thisUX.getValue('DropBox1');
      var filterFunc = function( list2Record ) { return list2Record.someField == this; } // 'list2Record' is a placeholder name, choose anything you like, 'someField' must be name of field you are filtering on
      var mapFunc = function( list2Record ) { return [ list2Record['your_display_field'], list2Record['your_stored_value_field'] ];
      var list2 = thisUX.getControl('List2');
      var tmpAry = list2.data.filter( filterFunc, filterVal );
      var datAry = tmpAry.map( mapFunc );
      var dropDown2EleID = '{dialog.object}' + '.V.R1.' + 'DropBox2';
      if( datAry.length == 0 ) {
      // Oops, no data - might have to hide dropdown 2 and display an error message
      }
      else {
      // show dropdown 2, if you chose to hide it when there is no data
      // populate dropdown 2
      A5.form.populateSelect(dropDown2EleID, datAry[0][1], datAry, true);
      // if don't want to pre-select first item then need to deselect it, not sure how.
      // Best would be to not select first item, but don't know how to do that in the .populateSelect ()
      }
      }

      When the function is called you would pass it one parameter, {dialog.object} .

      It would be best to make the refreshDropBox2 function name unique by either attaching it as a function to the UX or prefixing the function name with the alias of the UX, {Dialog.ComponentName}.

      Comment


        #4
        Re: 2nd Attempt: UX lists and dropdownboxes

        Addendum: After rereading your OP, I see you want to filter dropbox2 on three field values from dropbox1. As DavidK pointed out to you, you can only have two fields in a dropdown box: 1) a display field and, 2) a stored value field. Things will be so much simpler if you just add a unique identify field to your DB. But, if you don't add an identity field then you will have to concatenate the three values into a single value that can be used as the 'stored value' field in dropdown1. Just be sure you concatenate the strings by using a token separator. Alpha likes using ":" and "::" and "." as separators. You would need to change the filterVal field in the example code to be the concatenated value of all three fields and then change the filterFunc to compare 'this' against a concatenation of the three fields:

        return (list2Record.FieldA + ':' list2Record.FieldB + ':' list2Record.FieldC) == this;


        =
        Last edited by RichCPT; 03-01-2017, 12:53 PM. Reason: changed 'filterVal' to 'this' in example.

        Comment


          #5
          Re: 2nd Attempt: UX lists and dropdownboxes

          Thank you so much for the feedback. Its refreshing and appreciated.

          I've been away for a while but will immediately start testing (learning) the above advice and possible solutions. Never in my wildest thoughts did i think this would become such an "interesting" task. Greek now, but will make sense after a few days.

          I have attached the "source data" extracted to a txt file so you can see the choices and/or data i'm working with.

          Rich, what needs to happen is this;
          DDB1 gets its value from LIST2 field1.
          DDB2 gets its value from LIST2 field2 BUT have many values to choose from. Thus it must be filtered based on the selecting made in DDB1 field1

          And so forth.
          DDB3 gets its value from LIST2 field3 BUT have many values to choose from. Thus it must be filtered based on the selection made in DDB1 AND DDB2

          In the end i will have exactly 7 DDBoxes which needs this. I was very forward in expecting assistance in all 7, but understand that if i can get the concept on the first 2 boxes, the rest i'll be able to work out myself.

          I remembered; "Feed a man a fish and he's fed for a day BUT teach him how to fish and he's fed for life"
          Attached Files
          Last edited by CLaubscher; 03-01-2017, 01:44 PM.

          Comment

          Working...
          X