xml help please. - InfoPath Dev
in

InfoPath Dev

xml help please.

Last post 05-13-2010 02:31 AM by Catharine. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-12-2010 09:47 AM

    xml help please.

    I have a main data source

    myFields
        SKUIntroductionGroup
            Asset (repeating)
        Calc
            SiteManager

    I have a secondary data source "Lookups"(xml) (which I use for the multi selection list values for Asset in the main data source)

    Lookups
        Assets 
            Asset (repeating)
               Site

    And a second secondary data source  "GetWhosWho"(dataconnection from SP)

    row (repeating)
        Email
        Role
        Region

    I want to put the correct email into my field SiteManager.  Selecting Email from GetWhosWho, and filtering on the Region  - where Region is equal to the Site (in lookups) - and the Site (in Lookups) has a parent (Asset) which matches the first Asset selected in the main data source. (Convoluted huh!)

    So to build up to my requirement - I have created an expression box to pull out the first asset in the main data source.

    my:SKUIntroductionGroup/my:Asset[. != "" and 1] and this works fine (call this first asset)

    I have then created an expression box to pull out the site of the first asset in the main data source

    xdXDocument:GetDOM("Lookups")/Lookups/Assets/Asset/@Site[xdXDocument:get-DOM()/my:myFields/my:SKUIntroductionGroup/my:Asset[. != "" and 1] = ..]

    this does not work as I expected - my xml is obviously not right.  If I tick items on my list going downwards it seems to work ok

    but if I tick the items in a bizarre order - it always picks seems to sort on the Lookup list rather than the main data source.

    e.g. if the LookupList is

    Asset A site siteA
    Asset B site siteB
    Asset C site siteC
    Asset D site siteD

    And in the multi selection box I select in the order

    Asset A
    Asset B
    Asset D

    then my expression box brings me siteA

    If in the multi selection box I select in the order

    Asset C
    Asset B
    Asset A

    my expression box brings me siteA but my "first asset" expression box brings me Asset C

    Obviously I cannot move on to my next level of complexity until I have figured this one out.  I have been trying various things for the last couple of hours, some inspiration from an xml expert would be gratefully received.  (I cannot use the display name/value option in the multi selection box as I want to store the asset not the site)

    Thank you.

    Catharine

  • 05-12-2010 05:56 PM In reply to

     Hello Catharine,

     Please try changing this:

     my:Asset[. != "" and 1]

    to this:

    my:Asset[. != ""][1]

    The [number] node test only works when the number is in the brackets by itself.  In the and expression you have there, the 1 is being treated as the boolean value true, giving it essentially no meaning at all.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-13-2010 02:31 AM In reply to

    Thank you very much.  This works fine.  I didn't know you could put two [] together like that.  The [. !="" and 1] was the default created by infopath. 

    I will know for the future.

    As always - much appreciated.

    Catharine

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