Saturday, August 29, 2015
Text Size

Sort order a dropdown list in MS InfoPath without programming

So this is for Microsoft Office Infopath 2007 (SharePoint 2007).

The situation is that I started creating a SharePoint List (datasheet) and when I made my form dropdown read from the list, it just put elements in the order that I entered them in the datasheet.

Googling this led me to browse MSDN for an hour before I realised all those experts were using programming solutions that seemed a bit over the top for something that should be so simple.

Hey presto, I found a cheat/workaround:

  1. Click on the list to see your datasheet (has a MS Access icon in the top left to remind you what you're getting yourself into)
  2. Go to Settings
  3. Select Create View
  4. Select Datasheet View (you could probably use a "Standard View", I just used the Datasheet one)
  5. Give the view a name, select what columns you want the form to have (I included the IDs for functional purposes)
  6. Further down the "Create View" page, there should be a Sort section, specify the column to sort by.
  7. Save the view by clicking the OK button.
You'll be returned to your datasheet and it's possible it isn't in any different order. I re-checked out my InfoPath form, looked at the dropdown that was already configured to read off the sharepoint list, and it had re-ordered to what I set in the view!!! I don't really understand how it works only that it does. I think this could get complicated if you had two dropdowns reading off the same list but needed to list elements in different orders.

If you haven't made a dropdown list yet There's other instructions out there on the web but I thought I'd put what I did so that when I did the above it would all work:
  1. Open your form in InfoPath
  2. Go into Design mode
  3. Go to "Controls" and add a Drop-down List Box to your form
  4. Right-click it and select "Drop-down List Box Properties"
  5. Under "List box entries" select Look up values from an external data source
  6. Next to "Data source" click on Add
  7. Select "Create a new connection to" and then Receive Data
  8. Select SharePoint library or list
  9. Copy the URL/web address from your browser which has the datasheet open (eg. "http://your_sharepoint_server_name/Lists/your_list_name/Allitemsg.aspx")
  10. Select the name of your list (I know I thought we already did this but hey ho)
  11. Select the fields of this list you want to use (only really need ID and Name or just the one if your dropdown values will be the same as the display labels)
  12. Next > Next > Finish
My Google Searches (ignore this, it's for me):
  • infopath look up values sharepoint list sort by
  • order drop-down list box without/no programming code


Mike P
# Mike Tue, 22nd November 2011
I was struggling with this as well, then I checked the Data Connection to receive the values and there is a sort option on the data connection.

Too simple!

Like | Dislike | +2 Reply | Reply with quote | Quote
# Nerfe Fri, 24th August 2012
Hi Mike,

Are you refring for Infopath 2007 or 2010? In 2007 I cannot see sort option.

Like | Dislike | 0 Reply | Reply with quote | Quote
# amanda Thu, 16th February 2012
Joel - sadly this does not work for me.
Like | Dislike | 0 Reply | Reply with quote | Quote
Erfan M
# Erfan Wed, 14th March 2012
when I open it as a form which opens in client application, work fine, but when I wanted to open it in web page it sorted by ID. what can I do with this
Like | Dislike | 0 Reply | Reply with quote | Quote
# Joel Thu, 15th March 2012
Hi Erfan,

I found that if you open your spreadsheet and then select view > modify this view then you can modify the default sort view there. This is the second dropdown in the right margin (top right of data) and below the "site actions" dropdown.

Like | Dislike | 0 Reply | Reply with quote | Quote
Omid Z
# Omid Wed, 24th October 2012

I am having the same issue as Erfan. I followed your instructions and even though i sort the list by a different field, in my web form dropdown it still sorts by id.
Like | Dislike | 0 Reply | Reply with quote | Quote
# Joel Fri, 26th October 2012
Hi Erfan,

Sorry for the delay. My team decided not to use InfoPath as a solution and as such, my access to a test system has been limited. I will have a look again when I get the chance post a solution when I find one.
Like | Dislike | 0 Reply | Reply with quote | Quote
Patrick S
# Patrick Tue, 31st July 2012

did you manage to find a solution to show the correct sorting in the web form?

Like | Dislike | 0 Reply | Reply with quote | Quote
# Inland_surfer Tue, 27th November 2012
I changed the default view for the dropdown datasource as a SharePoint list to sort by the column I want in the infopath form. It worked like a charm Thanks!
Like | Dislike | 0 Reply | Reply with quote | Quote
# shiva Mon, 16th February 2015
Thanks, That helps n saved my time
Like | Dislike | 0 Reply | Reply with quote | Quote
# BamaBob Fri, 15th May 2015
:lol: Works perfectly! Thanks.
Like | Dislike | 0 Reply | Reply with quote | Quote
Add Comment





Help Develop!

Thank You! :c)

Connect: Google+

Visitors of the World

Latest Posts