Sorting a drop down list from SQL data source - InfoPath Dev
in

InfoPath Dev

Sorting a drop down list from SQL data source

Last post 05-19-2014 07:57 AM by fcoulter. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-26-2009 07:08 PM

    • djj66
    • Not Ranked
    • Joined on 05-27-2009
    • Posts 13

    Sorting a drop down list from SQL data source

    Hi everyone,

    I am using Infopath 2003, with VBScript where needed. I have created a form which is working well and which has several drop down lists which get their data from a SQL secondary data connection. As far as I can tell, there is no way to sort this drop down list(??) - it is always sorted using the Primary key field of the SQL table - is that correct?

    I have read several articles on this site about how to sort DDL's but none seem to apply to my exact situtation - I'm not using a Sharepoint list, nor a browser enabled form.

    Is it possible to resort the data coming into the Drop down list? - and how, do I need to use a "Preserve code block"? and do I need to use Code behind as well? (in VBSCRIPT)

    I know how to create a preserve code block, but not what to put in it? If someone can tell me exactly what I need to do, and a few snippets of code, I'm sure I can do the rest.

    Thanks in advance for your help, and hope to hear from someone soon :-)

    regards, david

     

  • 05-26-2009 10:27 PM In reply to

    Re: Sorting a drop down list from SQL data source

    Hi David,

    Indeed the preserve code block with xsl:sort is one way to do it. Greg's post: http://www.infopathdev.com/forums/p/4107/16226.aspx . You'll need to save your files as source and manually modify the XSL file. If you need help, send $50 to our PayPal account (Sales at no spam please Qdabra.com) and we'll walk you through it. It's not that hard, but will require about 30 minutes.

    Cheers,

    Patrick Halstead
    Project Manager at Qdabra
  • 05-27-2009 08:26 AM In reply to

    Re: Sorting a drop down list from SQL data source

    This is just a plain SQL data connection? When you walk through the data connection wizard, you have the option to click the Modify Table button to the right of the window that displays your table and columns in a tree structure. When you click the Modify Table button, you can specify sort options. You also have the option to edit the SQL directly....

    Hilary Stoupa

  • 05-27-2009 03:54 PM In reply to

    • djj66
    • Not Ranked
    • Joined on 05-27-2009
    • Posts 13

    Re: Sorting a drop down list from SQL data source

    Hi Hilary,

    Yes it's just a plain old SQL data connection - You're exactly correct - I can use the sort options after pressing the Modify button.

    I've been working with InfoPath for about 4 months, but never pressed that button to see the sort options. (whoops, feel rather embarrassed now)

    I've wasted hours and hours on this problem, looking at preserved code blocks, code behind etc. You've saved me hours more wasted effort.

     Thanks so much,

    regards
    David

  • 10-19-2009 10:31 AM In reply to

    Re: Sorting a drop down list from SQL data source

    Thanks Hilary!  It's nice when I don't have to spend more time than necessary to ahieve these simple things that seem to eat my lunch on many occasions :)

  • 05-19-2014 07:57 AM In reply to

    Re: Sorting a drop down list from SQL data source

    Add me to the list of people who feel stupid.

     

    I was working with InfoPath 2007 in my old job, and we had edited the SQL query in order to sort the results.  Now that I'm at a new job, with InfoPath 2013 on my desktop, I lost access to my old notes.  So I was going to come here to find how to modify the query so that it sorted the results.

    AND IT'S BUILT INTO INFOPATH!  AND IT'S BEEN IN INFOPATH THE WHOLE TIME.

     

    Face plant time.

     

    Thanks for letting me know about the obvious. 

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