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:
- 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)
- Go to Settings
- Select Create View
- Select Datasheet View (you could probably use a "Standard View", I just used the Datasheet one)
- Give the view a name, select what columns you want the form to have (I included the IDs for functional purposes)
- Further down the "Create View" page, there should be a Sort section, specify the column to sort by.
- Save the view by clicking the OK button.
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:
- Open your form in InfoPath
- Go into Design mode
- Go to "Controls" and add a Drop-down List Box to your form
- Right-click it and select "Drop-down List Box Properties"
- Under "List box entries" select Look up values from an external data source
- Next to "Data source" click on Add
- Select "Create a new connection to" and then Receive Data
- Select SharePoint library or list
- 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")
- Select the name of your list (I know I thought we already did this but hey ho)
- 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)
- Next > Next > Finish
- infopath look up values sharepoint list sort by
- order drop-down list box without/no programming code
:lol: Works perfectly! Thanks.
Thanks, That helps n saved my time
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!
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.
Webmaster,
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.
Hi Mike,
Are you refring for Infopath 2007 or 2010? In 2007 I cannot see sort option.
Thansk,
Nerfe
@Erfan,
did you manage to find a solution to show the correct sorting in the web form?
Patrick
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.
Joe
hi
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
Joel - sadly this does not work for me.
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!
Thanks!
Mike