Change variable text within a control's default value based on form data - InfoPath Dev
in

InfoPath Dev

Change variable text within a control's default value based on form data

Last post 10-26-2012 11:32 AM by Anson Hidajat. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-24-2012 08:23 AM

    Change variable text within a control's default value based on form data

    Ok, I'm a newbie to Infopath, but think I know enough to be dangerous. I've searched through the forum for my particular issue, but could not find anything like what I need to fix. I'd appreciate any help you can provide.

    I have a form that has a drop down list box tied to a secondary data connection (XML resource file) with three criteria:

    LevelA

    LevelB

    LevelC

    Each one of these, when selected, populate starter text into a corresponding text box. That part I got working (thanks goes to Hilary Stoupa for her sample.xsn file - unfortunately, I could not locate the post that I got it from; I stumbled on it looking for something else).

    In the starter text (a template if you will), I have variables within the text that I need to replace based on data entered into the form elsewhere. By variable text, I simply mean I've designated keywords in that particular element in the XML file to identify them as replaceable.

    StarterText example:

    VariableA sometext sometext. VariableB sometext VariableC sometext... etc.

    So my question:

    How would I take variable text populated via a formula in the default value of the text box and replace it with data from the form?

    Additional criteria: I need to be able to expand this to any number of variables as the starter text may change in the future, so I need it to be scalable.

    I hope that's enough information to help solve this problem.

     

    Thanks for your help!

  • 10-26-2012 11:32 AM In reply to

    Re: Change variable text within a control's default value based on form data

    That's an interesting scenario.  InfoPath doesn't do a great job of replacing entire terms like VariableA or VariableB with another term.  You could set up your formula so that it displays like concat("some text here", VariableA, " and some more text ", VariableB).  Then the variables are text fields which you can change at will.  However, this approach is not data driven and will require changes to the form if you decide to add more variables or change the text.  Hope this at least guides you in the right direction.

    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

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