Infopath组合框选择项目,但在其他组合框中选择的项目除外

时间:2012-10-21 13:40:15

标签: xpath infopath infopath2010

我有一个InfoPath表单,其中Departments作为重复表输入,所有部门都在这里输入。

然后我有第二个重复表,用户输入。该行包含3列:用户名字符串,UserDepartmentCombo1(可从查找部门的下拉列表中选择)和CoveragePathCombo2下拉列表(再次从部门列表中查找)。

Infopath的XML输出如下:

<?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>

我的CoveragePath组合框XPath如下:/my:myFields/my:group1/my:Departments/my:DeptName

我希望组合框CoveragePath下拉到不包含行UserDepartment组合框中选择的部门,我该怎么做呢?

1 个答案:

答案 0 :(得分:0)

使用

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

您需要在第一个组合框中选择的内容替换$selected