locked
Search a datasource for a matching value RRS feed

  • Question

  • The following code always works in my form when running on the client but does not work (vendor returns null) when the form is published . I suspect it could be the white-space but have no evidence of it and if true wouldn't it fail on the client. This is a web form that is Administrator  Approved and has Full-Trust. Any suggestion?

     

     XPathNavigator root = MainDataSource.CreateNavigator();
     string payeeTypedName = e.NewValue.ToUpper();
     string vendorID = string.Empty;
    
              
    XPathNavigator payeeDS = DataSources["Vendors"].CreateNavigator();
    
             
     // Search for the matching vendor
     XPathNavigator vendor = payeeDS.SelectSingleNode(
                        "/dfs:myFields/dfs:dataFields/d:tblVendors[@Name ='" + payeeTypedName + "']", NamespaceManager); 
    

     


    Thank You

    Marcus

     


    • Edited by mwhite01 Sunday, January 15, 2012 2:17 AM
    Sunday, January 15, 2012 2:16 AM

Answers

  • Hi,

    I have read your post over : "I did not see the Always option under Form Options\Compatibility, I'm using IP 2007.".

    The property is not here. You must go in your control (textbox, dropdown,...) and then right click on it. You will see a "Properties" tab. Here you have to go on the last tab "Form Compatibility" and put "Always".

    If you not set this property to "Always", the event is not firing on web form...

    You can not piut a breakpoint in your solution to see if the event is trigger and if not, what is the line that throw the error?

     

    Hope this helps.


    Visit my blog : http://rmatayron.blogspot.com/
    • Marked as answer by Wayne Fan Wednesday, January 25, 2012 9:10 AM
    Thursday, January 19, 2012 7:53 AM

All replies

  • Hi?

    I work with managed code like you and I'm sure it is not a coding problem.

     

    Are you sure that you enter in your event when the form is published?

    It is a known error. If you don't enter in the event, it is a problem on your field that would hire the event. You have to go into Properties / Form compatibility / Always. The event will be throw each time your control value will be change.

     

    If it is not your errorn, just have a look on what kind of connection are you using for the vendor datasource?

    The error must be that this connection could not be found when the form is published in SharePoint...

    Maybe that your connection try to find your element on your file system!

    Or maybe you don't have the authorisation to query this dataconnection when you are on SharePoint.

     

     

    Hope this helps.

     


    Visit my blog : http://rmatayron.blogspot.com/
    Monday, January 16, 2012 9:18 AM
  • Remi

    Thank You for responding.

    I am writing to the Event Viewer so I'm validating every line for the function in question.

    I did not see the Always option under Form Options\Compatibility, I'm using IP 2007.

    My datasource is responsible for showing a drop-down listing of the available vendors which it does successfully when the form is open but out of all the options you've mentioned I suspect it could be the connection. I am using a udcx file that connects to SQL Server 2008 that is Centrally managed and is only reading the information. 

    I suspect that I will be need to switch this to a Web Service but I am not aware of one to use to connect to SQL Server.  Are you?

    Thanks

    Marcus

    Tuesday, January 17, 2012 6:26 PM
  • Hi,

    Are you sure your event is triggered?

    Are you using an InfoPath web form or an InfoPath Client Form?

    With this response, i will help you.

     


    Visit my blog : http://rmatayron.blogspot.com/
    Wednesday, January 18, 2012 8:43 AM
  • I quite sure that the event is triggered and its a web form.
    Thursday, January 19, 2012 12:12 AM
  • Hi,

    I have read your post over : "I did not see the Always option under Form Options\Compatibility, I'm using IP 2007.".

    The property is not here. You must go in your control (textbox, dropdown,...) and then right click on it. You will see a "Properties" tab. Here you have to go on the last tab "Form Compatibility" and put "Always".

    If you not set this property to "Always", the event is not firing on web form...

    You can not piut a breakpoint in your solution to see if the event is trigger and if not, what is the line that throw the error?

     

    Hope this helps.


    Visit my blog : http://rmatayron.blogspot.com/
    • Marked as answer by Wayne Fan Wednesday, January 25, 2012 9:10 AM
    Thursday, January 19, 2012 7:53 AM