Sorting a dropdownlist - InfoPath Dev
in

InfoPath Dev

Sorting a dropdownlist

Last post 07-30-2008 02:45 AM by Shiva. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-24-2008 01:39 AM

    Sorting a dropdownlist

     

    Hi Everyone,

     

    I have around 10 dropdown lists in my InfoPath form.  All these refers to columns in the same table. I’m using direct database connection here.

     

    Now to sort the items in the dropdown, I’m keeping separate connection for the each of the dropdowns. And sorting it with the connection.

     

    But I’m facing lot of performance issues because of this.

     

    If I get data for all this drop down using a single connection, Is there a way I can sort from InfoPath..

     

    Any help is Appreciated.

     

    Thanks & Regards,

    Joseph

     

  • 01-24-2008 08:14 AM In reply to

    Hey Joseph.

    I believe sorting must be done in code for exisitng data. Also I believe you would still need a seperate list for each so that each can be stored seperately.

    Have you thought about using web services instead?  They perform much better and with the ones included in the Database Accelerator Package, you could actually perform dynamic queries. So instead of returning the whole list and having to filter you could return just the relevant subset based on previous selections or other factors. Also you would have the ability to submit data back to multiple SQL tables.

    Qdabra Database Accelerator Suite Version 2.1 - Developer

    That may be an advantage.

    On your current queries, if you are not doing so already, make sure you are only selecting the columns you need.

    Filed under:
  • 01-24-2008 08:24 PM In reply to

    Hi Joseph and Clay,

    XSL supports sorting but that will require manually modifying your view.xsl. Extract your source files and open your xsl and add the xsl:sort to the dropdown control. Not sure it will work for dropdowns but I know it works for tables, etc., so it should work. This will require an xd:preserve block around the control so that the InfoPath Designer doesn't remove the sort on roundtrip. Let us know if you need an example, and we can hunt one up.

    Sorting in code... well, yes, but no on the main DOM. Copy the elements into a separate XML DOM internally and create an index array. Sort the indexes which refer to the items. Then, copy the XML DOM into your main DOM using the indexes That's how you should do it. For an example of how to sort in code (albeit jscript), look at the Asset Tracker solution which ships as a sample in InfoPath 2003 - Greg and I added sort to that.

    Lastly, you could sort the data when you query it from the database server by creating a view on your database that sorts the data and recreating your form based on that view. Or, you could use our EnumDB web service to pull down the values and sort them. Here's a link to an article that describes how to do it with EnumDB: http://www.infopathdev.com/forums/t/6399.aspx

    I hope this helps!

     

    Patrick Halstead
    Project Manager at Qdabra
  • 07-29-2008 11:41 AM In reply to

     Hi Patrick

    Can you give me some example for  Preserve block?

     

    Thanks in advance 

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.