Question

I have an InfoPath form where Departments are entered as a Repeating Table, all departments are entered here.

I then have a second Repeating Table where users are entered. The row consists of 3 columns: a Username string, a UserDepartmentCombo1 (selectable from a dropdown list that looks up the Departments), and a CoveragePathCombo2 dropdown (again looking up from the Department List).

The XML output by Infopath is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<?mso-infoPathSolution solutionVersion="1.0.0.6" productVersion="15.0.0" PIVersion="1.0.0.0" href="file:///C:\Users\user\Desktop\test.xsn" name="urn:schemas-microsoft-com:office:infopath:test:-myXSD-2012-10-21T13-16-52" ?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.4"?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-10-21T13:16:52" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-gb">
  <my:group1>
    <my:Departments>
      <my:DeptName>Accounts</my:DeptName>
      <my:field3>false</my:field3>
    </my:Departments>
    <my:Departments>
      <my:DeptName>Sales</my:DeptName>
      <my:field3>false</my:field3>
    </my:Departments>
    <my:Departments>
      <my:DeptName>Support</my:DeptName>
      <my:field3>false</my:field3>
    </my:Departments>
    <my:Departments>
      <my:DeptName>Reception</my:DeptName>
      <my:field3>false</my:field3>
    </my:Departments>
  </my:group1>
  <my:group2>
    <my:Users>
      <my:UserDepartment>Sales</my:UserDepartment>
      <my:Username>Chris</my:Username>
      <my:CoveragePath>Reception</my:CoveragePath>
    </my:Users>
    <my:Users>
      <my:UserDepartment>Sales</my:UserDepartment>
      <my:Username>Jon</my:Username>
      <my:CoveragePath>Accounts</my:CoveragePath>
    </my:Users>
  </my:group2>
</my:myFields>

My CoveragePath combobox XPath is as follows: /my:myFields/my:group1/my:Departments/my:DeptName

I would like the combobox CoveragePath drop down to not include the department that was selected in the rows UserDepartment combobox, how would I go about doing this?

Était-ce utile?

La solution

Use:

/my:myFields/my:group1/my:Departments/my:DeptName[not(. = $selected)]

where you need to substitute $selected by whatever was selected in the first combo box.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top