Alpha DevCon 2018
Results 1 to 17 of 17

Thread: Use multi-select in list control to insert selected records to a UX bound table

  1. #1
    Member
    Real Name
    Carsell Lankford
    Join Date
    Aug 2015
    Location
    Fontana, CA
    Posts
    94

    Default Use multi-select in list control to insert selected records to a UX bound table

    Hello all,

    It seems like this should be a fairly straight-forward process, however I have been unable to find a solution.

    In short, I have a list control that lists all company items ready to "add" to purchase order.

    I'm trying to have a functionality for a user to click all the items that they want to use to "build" a purchase order. I have a SQL table built which would house all the item details for a given PO.

    I was hoping to simply click all the desired items, then use a button that would fire a list control action that would add all selected items to my repeating section to list all the selected items. I'm currently using the action - "Populate controls with data from a current row in list", which works, however it only adds one row at a time, as stated in the function. Is there one that would populate data from all "selected" rows?

    Any ideas? I'm open to any suggestion. I basically want the functionality to select multiple and click a button to send all selected items to another table...

    Thank you in advance for your help.

    -Casey

  2. #2
    Member
    Real Name
    Riley Lappin
    Join Date
    Sep 2014
    Posts
    95

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    You could do this a number of ways depending on how complex you wanted to get..

    Since you are utilizing the repeating section and populating the controls I'm assuming from the OnSelect event of the list, you need to access the repeating section and list arrays to get it working like that.. Are you dead set on using a list control?

    Have you considered using the repeating section (details table) and doing a dropdown on say... the order item field so that users are able to select order items from a dropdown and add as many order items as they'd like to?.. Ideally, when the order item is selected, if you have any additional fields that need to be saved to details table, you can do a fill-in based on order item selection..

  3. #3
    Member
    Real Name
    Carsell Lankford
    Join Date
    Aug 2015
    Location
    Fontana, CA
    Posts
    94

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Hello Riley,

    Right, I have examined different ways and thought of doing a drop-down menu for each line of the repeating section, however just thought from a user experience standpoint might be most useful to see all the items listed in one clean list and just click away on the items they want to order, as opposed to going to each line and scrolling down to each. Just seemed like more clicks. Also my item lookup table which is about 10k items sometimes take longer in drop-down than a list does....

    I would also like to just know how to insert multiple records into a table. THis has been my only block wall on thinking of how to do certain things. Being able to update records one at a time is a breeze, but when it comes to inserting a bulk batch of records I have not found a simple way to do.

    In the meantime, can you elaborate on using "list arrays"? I have yet to use this functionality.

    Thanks again, Casey

  4. #4
    Member
    Real Name
    Jeremy Scrime
    Join Date
    Sep 2015
    Posts
    67

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Hi Casey..

    I'm following up on this request as I have a similar concept I need to implement and it seems as if it is a common enough scenario that I would need to implement the concept over and over.

    In my particular case, I have a list of users (upwards of 800) and a list of applications (upwards of 200). I'd like to present a screen showing a selected application and then have two lists.

    One list would contain all the users that currently have access to the selected application
    The second list would be for all other users who don't have access

    The idea would be to move items between lists so that user access could be removed as well as moving unassigned users into the access list.
    I've gotten as far as setting up the two lists with 4 buttons (>, >>, <, <<) and the queries work so that they show current access users and the remaining users.

    My question is, once the lists are completed to a users satisfcation, how do you go about saving the data.

    The underlying database is SQL Server and we are talking about 3 tables (RegisteredUsers, Applications, and a cross table RegisteredUsersXApplications).
    The cross table has 3 fields, an auto increment primary key, a foreign key to RegisteredUsers and a foreign key to Applications)

    Thanks,
    Jeremy

  5. #5
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,671

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    The List control has a few properties that can be used to determine which rows are selected: .selection, .selectionKey, .selectionData, and value. selectionData, for example, is an Array of Objects, 1 for each row selected, carrying full data on each selected row.

    Code:
    var lObj = {dialog.Object}.getControl('list1');
    var rowData = lObj.selectionData;
    You'd then loop through rowData doing whatever you need. Or pass the data back to the server where you'd loop through and create your insert statement.

    SQL has the capability of inserting multiple rows.

  6. #6
    Member
    Real Name
    Scott Binger
    Join Date
    Oct 2011
    Posts
    286

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Casey/Jeremy, Did either of you get this to work? I have a similar need and struggling to get it to work. Thanks.

  7. #7
    Member
    Real Name
    Scott Binger
    Join Date
    Oct 2011
    Posts
    286

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Bump

  8. #8
    Member
    Real Name
    Jeremy Scrime
    Join Date
    Sep 2015
    Posts
    67

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    I did server side processing.

    On the javascript click event I added some code to call a server side function "SaveListData"
    1_SubmitButton Click Event.jpg

    The the "SaveListData" has a built in e._listData that contains the data.
    I then found a post on how to handle the list data server side.
    2_SaveListData.jpg

  9. #9
    Member
    Real Name
    Scott Binger
    Join Date
    Oct 2011
    Posts
    286

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Jeremy - thanks so much for providing this - can you, by any chance, recall the post you found for handling the list data server side?

  10. #10
    Member
    Real Name
    Jeremy Scrime
    Join Date
    Sep 2015
    Posts
    67

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Sorry, after looking further it was actually a video series.
    If you access the Video Finder from within Alpha by going to the Help Menu and selecting "Video Finder" there is a 6 part series that contains "everything" I know about lists. It was invaluable.
    Once the video finder opens, enter "UXL_V12--21" in the Filter.

    2016-09-12_14-26-12.jpg

  11. #11
    Member
    Real Name
    Scott Binger
    Join Date
    Oct 2011
    Posts
    286

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Thanks so much Jeremy. That's my new favorite Alpha video series! LOTS of information.

    One question: any idea how to move data from list A to list B WITHOUT removing it from list A? The list control action, "Move selected rows from one List to another List" is nice, but I don't want to remove the data from List A.

  12. #12
    Member
    Real Name
    Nate Mitchell
    Join Date
    Feb 2013
    Location
    Lexington, KY
    Posts
    103

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Hey Scott, after you move your selected record, you could always refresh the original list, although that involves an additional callback.

    Alternatively, it may be cleaner to just use the appendRows method and simply add a new row to your second list.

    Here is an example using sample data. Just add this code to the onClick event of the first list.

    Code:
    var fn = this.selectionData[0].Firstname;
    var ln = this.selectionData[0].Lastname;
    var ci = this.selectionData[0].City;
    
    var listObj = {dialog.object}.getControl('LSTTEST2');
    var _d = [{Firstname: fn, Lastname: ln, City: ci}]
    listObj.appendRows(_d);
    Nate Mitchell PMP

  13. #13
    Member
    Real Name
    Scott Binger
    Join Date
    Oct 2011
    Posts
    286

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Nate, thank you so much for your note and providing the sample code. It works exactly how you describe. Much appreciated.

  14. #14
    Member bob9145's Avatar
    Real Name
    Bob Senski
    Join Date
    Jun 2009
    Posts
    733

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    A working UX component with a list control that saves multiple selected rows to a north winds table, or sql table in general with an accompanying video would be very helpful. UXL_V12-21 touches on handling this data, but stops short of doing something useful with the submitted data like saving the entire list, or saving selected rows to a table. Seems this would be the most common use for the submitted data.

  15. #15
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,775

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Thanks for this thread. I needed to get an array of primary keys for selected records in a List. I set my List to return Primary Key and used...

    var lObj = {dialog.Object}.getControl('list1');
    var rowData = lObj.selectionKey;

    ...which returned an array such as ",0,1,4,2" which is in the order that the records were selected. Oddly it has a comma in the front which I stripped off. I then could use the array in a Callback to do back-end processing.

    But David - how in the world did you know about these List properties? The term ".selectionKey" is not in the documentation, release notes or in-line help.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  16. #16
    "Certified" Alphaholic Lance Gurd's Avatar
    Real Name
    Lance Gurd
    Join Date
    Jun 2005
    Location
    Southampton, UK
    Posts
    1,380

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Hi Steve,

    it is here https://www.alphasoftware.com/docume...lass/index.xml I spotted it the other day when I was looking at some list stuff I am working on.

  17. #17
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,775

    Default Re: Use multi-select in list control to insert selected records to a UX bound table

    Such an excellent reference page, thanks for pointing it out.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

Similar Threads

  1. Multi-Select List control
    By CampnJim in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 03-08-2016, 07:52 AM
  2. List Control - Multi Select - Does it create an array?
    By coleresources in forum Mobile & Browser Applications
    Replies: 9
    Last Post: 02-16-2016, 01:23 PM
  3. Multi-select list control array size
    By Peter.Greulich in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 03-04-2015, 05:14 PM
  4. Replies: 1
    Last Post: 06-05-2014, 05:08 PM
  5. Ordering selected in Multi select record list
    By Doug Chanley in forum Alpha Five Version 8
    Replies: 0
    Last Post: 08-10-2007, 11:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •