To diable or hide a field in Repeating Table - InfoPath Dev
in

InfoPath Dev

To diable or hide a field in Repeating Table

Last post 06-04-2007 09:36 AM by Greg Collins. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-28-2007 05:13 PM

    To diable or hide a field in Repeating Table

    Is it possible to hide/disable a field in a repeating box and make a condition that if there is more than 1 row then show the respective field (in that row). e.g. in my rpeating table i have 4 columns - name, position, cost centre and percentage.
    Percentage field by default can be disbale or hidden if there is only 1 row but if another row is inserted than the percentage field should be shown for user to input the value.
    Soham Bhatt
  • 05-29-2007 09:41 AM In reply to

    Re: To diable or hide a field in Repeating Table

    In your conditional formatting, you would use the count() function to determine how many rows are present.
  • 05-29-2007 06:48 PM In reply to

    Re: To diable or hide a field in Repeating Table

    i tried using the preceding sibling condition - count(../preceding-sibling::my:group5) but i'm confused to what condition should i use.....tried with expression but no luck. could you detail the step that i should take - thanks.
    Soham Bhatt
  • 05-30-2007 09:22 AM In reply to

    Re: To diable or hide a field in Repeating Table

    It could be an XPath issue. It all depends on where you are starting from. For example if your current position is my:group5, then you don't need the ".." and would use the XPath count(preceding-sibling::my:group5), however, if you are on a child node of my:group5, then you would need the "..".

    Once the XPath is correct, the count should return a valid value. Keep in mind that preceding-sibling doesn't account for the current node, so the returned count will be one less (i.e. if there's only 1 row, the count will be 0, if there are 2 rows, the count for the second row will be 1, and the first row will be 0).

    I understood that you wanted to always show the field if there was more than 1 row present (i.e. even show it in the first row). If that were the case then count() makes more sense, because you can go to the container node and count how many my:group5 fields there are total. So if you are currently at my:group5, you would use: count(../my:group5) > 1 as the condition.

    However, now it sounds like you never want to show the field for the first row, but always thereafter. In that case you can use position() > 1 to determine when to show it... or if you want to get more complicated, you can just use preceding-sibling::my:group5 as a boolean condition because the first row will always report false and every row thereafter will report true.

    Hope that helps.

  • 05-30-2007 06:26 PM In reply to

    Re: To diable or hide a field in Repeating Table

    Thanks Greg
    Soham Bhatt
  • 06-04-2007 09:36 AM In reply to

    Re: To diable or hide a field in Repeating Table

    Glad to have helped!
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.