XML Datatypes - InfoPath Dev
in

InfoPath Dev

XML Datatypes

Last post 12-16-2009 11:25 AM by pr0t0. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 12-15-2009 01:52 PM

    • pr0t0
    • Not Ranked
    • Joined on 12-15-2009
    • Posts 2

    XML Datatypes

    I'm creating a purchase order form and reading in an XML file specifying various companies, departments, managers, and amounts each manager can approve. It's the last part that's giving me trouble. I have a child element called 'Amount' that I'd like to compare to the total on the PO. I would then use this comparison to populate a drop-down list of managers capable of approving the PO for that amount. Currently, if I remove the part of the filter that makes this comparison, I get the expected results: the appropriate managers for the department. However if I add that filter, nothing populates in the drop-down. I'm working on the basis that this is caused by the comparison never evaluating to true due to a datatype conflict.

    Should I code my XML in such a way as to specify a certain element as a double datatype? I've played around with a couple of inline methods like: <element type="xsd:double">amount</element>; or <element value="amount" type="xsd:int"/> Although I'm assuming the quotes define the element as a string.

    This is my first foray into creating xml files and using them as data sources in SharePoint. Any help/pointers would be greatly appreciated.

    Filed under: ,
  • 12-16-2009 05:13 AM In reply to

    The XML data types in your schema aren't relevant as far as XPath goes.  XPath doesn't care if your data is an int, string, or floating point value as long as you use syntax that deals with numbers.  You can explicitly cast a value to a number by using the number() function if you need to, but it sounds like your problem here might be a rounding issue.  Could you give a bit more detail on exactly the type of logic you're using to decide which managers to list?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-16-2009 11:25 AM In reply to

    • pr0t0
    • Not Ranked
    • Joined on 12-15-2009
    • Posts 2

    Hi Jimmy. Thanks for the help.

    Background: I have a drop-down (billToName) that references the XML file for available companies. I have another drop-down (chargeTo) that references the XML file for departments, filtered on billToName.

    For the managers list, I am using the Filter Data tool for a third drop-down (authorizedApprover). I already have an existing filter on authorizedApprover with two criteria: value of xml element companyName is equal to Main data source billToName; and value of xml element deptName is equal to Main data source chargeTo. This works fine and shows me the expected list of managers for the company->department. When I add the third element to the filter: and value of xml element Amount is less than or equal to Main data source Total, the drop-list fails to populate. Total is a double data type.

    Does that make sense?

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