Alternating text value in Repeating Table - InfoPath Dev
in

InfoPath Dev

Alternating text value in Repeating Table

Last post 04-29-2009 09:11 AM by Tethibogz. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-29-2009 08:15 AM

    Alternating text value in Repeating Table

    Hi to all,

    My boss just introduced Infopath to me and his requirements is to have a conversation table for our agent and guest. the first field shows an alternate text between Agent and Guest everytime the insert item will be pressed. The second field will be the conversation details. Is it easy? Please help... thanks

    Agent

    Guest

    Agent

    Guest

    and so on...

  • 04-29-2009 08:41 AM In reply to

    Re: Alternating text value in Repeating Table

    If you don't need the "Agent" and "Guest" labels actually stored in the XML (i.e. their meaning is assumed based on their order in the list), you could try something like in the attached template.  I've simply used conditional formatting (right click the "Agent" and "Guest" expression boxes and click Conditional formatting... to see what I've done) to hide one label or the other in each row.

    If you want "Agent" or "Guest" to be stored in a field, you could try a technique described on this page:

    http://www.tkachenko.com/blog/archives/000156.html

    Basically you would set the default value of the field to:

    concat(substring("Agent", number(count(../preceding-sibling::my:group2) mod 2 = 1) * string-length("Agent") + 1), substring("Guest", number(count(../preceding-sibling::my:group2) mod 2 = 0) * string-length("Guest") + 1))

     It looks complicated, but you can use it as-is, just replacing the my:group2 part with the actual name of the repeating node.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 04-29-2009 09:11 AM In reply to

    Re: Alternating text value in Repeating Table

    Thanks Jimmy! I used the simple method that you gave. It works great.

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