concat a not(contains - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

concat a not(contains

Last post 12-17-2012 10:29 PM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-01-2012 01:25 PM

    • plavix
    • Not Ranked
    • Joined on 10-23-2011
    • Posts 2

    concat a not(contains

    Hi All,

    I've recently had wierd behaviour with a not(contains rule to filter drop-downs. Ordinarily it works fine, but I'll save the form, then open it some time later and it has split the rules to all the my:field1 in one rule and all the my:field2 in another rule. So, I'm left with Rule1 and Rule2 with mixed results.

    I'm fairly sure it's possible, but how do I concat all my:field1 or my:field2?

    Expression used is:

    not(contains(../my:Commodity, "Electrical Goods")) and not(contains(../my:Commodity, "IT/Computers")) and not(contains(../my:Commodity, "Household Contents Hub")) and not(contains(../my:Commodity, "Specialist Leisure Items")) and not(contains(../my:Commodity, "Garden Equipment & Power Tools")) and not(contains../my:Commodity, "Cycles")) and not(contains(../my:Commodity, "Musical Instruments")) or not(contains(../my:Instruction_Type, "Quote Only")) and not(contains(../my:Instruction_Type, "Replace")) and not(contains(../my:Instruction_Type, "Inspect & Report")) and not(contains(../my:Instruction_Type, "Validate"))

    Which I've tried to concart as, amongst others:

    not(contains('../my:Commodity', concat("Electrical Goods", "IT/Computers", "Household Contents Hub", "Specialist Leisure Items", "Garden Equipment & Power Tools", "Cycles"))) or not(contains('../my:Instruction_Type', concat("Quote Only", "Replace", "Inspect & Report", "Validate")))

    I'm hoping this will stop the splitting of the rules.

    Thanks.

  • 12-17-2012 10:29 PM In reply to

    The second formula won't work because it will only filter out cases where Commodity contains "Electrical GoodsIT/ComputersHousehold Contents HubSpecialist Leisure ItemsGarden Equipment & Power ToolsCycles" or Instruction_Type contains "Quote OnlyReplaceInspect & ReportValidate" (also, ../my:Commodity and ../my:Instruction_Type shouldn't be in quotes).

    I think the best approach here would be to create a secondary XML data source with the values you want to check for:

    <FormLogic>
      <CommodityFilterValues>
        <CommodityFilterValue>Electrical Goods</CommodityFitlerValue>
        <CommodityFilterValue>IT/Computers</CommodityFitlerValue>
        ...
      </CommodityFilterValues>
      <InstructionFilterValues>
        <InstructionFilterValue>Quote Only</InstructionFilterValue>
        ....
      </InstructionFilterValues>
    </FormLogic>

    Then your formula would reduce to:

    not(CommodityFilterValue[contains(current()/../my:Commodity, .)]) or not(InstructionFilterValue[contains(current()/../my:Instruction_Type, .)])

    I'm not sure what you're using these condition's for, but I'm a little suspicious of that or in the middle.  Depending on what you're trying to do, it may be the case that it should be and.

    Jimmy Rishe / Software Developer / InfoPath MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2012 Qdabra Software. All rights reserved.
View our Terms of Use.