Replace text with "" - InfoPath Dev
in

InfoPath Dev

Replace text with ""

Last post 02-10-2010 06:06 AM by mhoel. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-10-2010 01:02 AM

    • mhoel
    • Not Ranked
    • Joined on 01-25-2010
    • Posts 17

    Replace text with ""

    Hi.

    I have a text field that contains word;anotherword;anotheranotherword and when I press a buttona have made an action that replaces this word with the translate function

    translate(field; textbox; "")

    The textbox contains the word i want to remove, but it removes every character that matches, which there is nothing wrong with. But i want to remove the whole word, not every character that matches.

    Is there a method to do this?

  • 02-10-2010 03:26 AM In reply to

    the simplest way to do it without even a button click will be to write a rule on the text field

    if text_field contains your_specific_word

    set text_field = concat(substring-before(., "your_specific_word"), substring-after(., "your_specific_word"))

    if you want this to be set on a button click then you will have to create another field say field_2

    set the default value of text_field to field_2

    set the above rule on field_2

    and on button click set teh value of field_2 to text_field

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 02-10-2010 04:36 AM In reply to

    • mhoel
    • Not Ranked
    • Joined on 01-25-2010
    • Posts 17

    I should probably explain a bit better :).

    I have 7 drop down list boxes (lst_a, lst_b,.,.,.,., with around 100 usernames. These are needed to for approval purpose. 

    The approval button needs to be disabled for everyone else than these 7 users, plus when they have clicked on the approve button, it should be disabled for them too.

    So i have made 2 buttons (btn_a and btn_b). When they click on btn_a it puts all 7 usernames into a textbox (txt_a) separeted by ";".

    When the approver_a (lst_a) are clicking on btn_b, it should remove approver_a's username in txt_a, so the button becomes disabled for approver_a.

    btn_b is only available for lst_A if txt_a contains lst_a.

    Is there another way to do this or can i still use the translate function somehow?

    Thanks! :)

  • 02-10-2010 05:07 AM In reply to

    so as far as i get from this all that is pending is removing the username from the field on button click on button click write a rule and add the following action

    set the value of  text_a = concat(substring-before(text_a, userName()), substring-after(text_a, userName()))

    try it and let me know if it works properly

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 02-10-2010 06:06 AM In reply to

    • mhoel
    • Not Ranked
    • Joined on 01-25-2010
    • Posts 17

    IT WORKS PERFECTLY!! :)

    Thank you for the second time today, Qazi Anis!! :)

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