Use of Translate() Function in Multiple-Line Text Box - InfoPath Dev
in

InfoPath Dev

Use of Translate() Function in Multiple-Line Text Box

Last post 08-25-2011 07:04 AM by dsfcom. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 08-22-2011 05:00 AM

    • dsfcom
    • Not Ranked
    • Joined on 08-22-2011
    • Posts 8

    Use of Translate() Function in Multiple-Line Text Box

    I have read many posts on this forum concerning the use of a Translate() function (specifically, placing translate(., "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ") in the value field for the text box) in order to convert all text into CAPS and have been using it quite successfully until now. I have a text box that is muli-line with paragraph breaks and wrapping of text allowed.  I am pretty sure it is the paragraph breaks that are causing my problem but I need to keep them enabled and still convert text entered into the box into CAPS.

    The problem is that whenever multi-line text is inputted an error: "A calclulation in the form has not been completed.  The number of calculations used for a single action exceeded the maximum limit."

    This does not prevent the text from being converted to CAPS but the error message is quite annoying.

    Any ideas?

     

    Thank you.  -Don

    Donald Fisher
  • 08-22-2011 06:12 AM In reply to

    Re: Use of Translate() Function in Multiple-Line Text Box

    I believe that something like this should probably work:

    http://www.infopathdev.com/forums/p/19919/69074.aspx#69074

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-23-2011 01:51 AM In reply to

    • dsfcom
    • Not Ranked
    • Joined on 08-22-2011
    • Posts 8

    Re: Use of Translate() Function in Multiple-Line Text Box

    Thank you Jimmy.  I have tried the method mentioned in thread http://www.infopathdev.com/forums/t/19919.aspx but have so far had no luck.  This is what I did which may or may not be in line with the instructions provided.

    1. Added text box to form named "calculating" with a default value of false() (the text box has conditional formatting to hide it when the section is both signed or unsigned; always hidden)
    2. Added the fllowing rules to a text box named "UTM_UNIT_ADDRESS" (which contains the multi-line text to be converted to ALL CAPS)
         a. Condition: calculating = false()
         b. Action1: Set 'calculating' = true()
         c. Action2: Set '.' = translate(., "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
         d. Action3: Set 'calculating' = false()

    The result is that none of the text in text box 'UTM_UNIT_ADDRESS' is converted to ALL CAPS.

    The same holds true when only action 2 is set as the only rule for text box 'UTM_UNIT_ADDRESS' and I have tried with the text box 'calculating' as hidden and not hidden.

     

    What I ended up doing which appears to be working well is two actions with the first setting text box 'calculating' = translate(., "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ") and the second setting 'UTM_UNIT_ADDRESS' to = 'calculating'.

    For learning purposes, did I do something wrong when trying to use the method in above thread?  Thanks again!

    Don

    Donald Fisher
  • 08-23-2011 02:37 AM In reply to

    Re: Use of Translate() Function in Multiple-Line Text Box

    Hm, seems to work in this template.

     Could you attach a screenshot of the dialog where you set up the condition, or the whole XSN if you don't mind sharing it?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-23-2011 05:23 AM In reply to

    • dsfcom
    • Not Ranked
    • Joined on 08-22-2011
    • Posts 8

    Re: Use of Translate() Function in Multiple-Line Text Box

    I have attached a screen-shot of the dialogs showing how the rules were set up.  If that does not help I might be able to change the form enough to post.


    Donald Fisher
  • 08-23-2011 05:33 AM In reply to

    Re: Use of Translate() Function in Multiple-Line Text Box

    If you created the calculating field as a Boolean field, the condition dialog should let you select between TRUE and FALSE in the right-hand dropdown box.  That calculating = false() that you have there doesn't look right to me.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-23-2011 06:00 AM In reply to

    • dsfcom
    • Not Ranked
    • Joined on 08-22-2011
    • Posts 8

    Re: Use of Translate() Function in Multiple-Line Text Box

    Pardon my lack of knowledge on the subject but I am not sure how to add a Boolean field.  I added a text box control but do not see anything indicating a Boolean field.

    Donald Fisher
  • 08-23-2011 07:04 AM In reply to

    Re: Use of Translate() Function in Multiple-Line Text Box

    If you open the properties dialog for the textbox or the field in the taskpane, you can select True/False (boolean) as its datatype.

    BTW, you don't have to have the field represented as a control (textbox) in your form in order for it to exist and serve its purpose within the data source.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-24-2011 07:13 AM In reply to

    • dsfcom
    • Not Ranked
    • Joined on 08-22-2011
    • Posts 8

    Re: Use of Translate() Function in Multiple-Line Text Box

    I am following now. I've made the change to Boolean and uploaded the form. When the Unit Address field in the upper portion of the form is filled in with a single line of text the translate() function works fine.  When multiple lines are entered with carriage returns an error message is displayed and then the text is converted to ALL CAPS.  I'm not sure what is causing the error message.  Is the method I am using that works not a good one?

    Don

    Donald Fisher
  • 08-24-2011 07:54 AM In reply to

    Re: Use of Translate() Function in Multiple-Line Text Box

    It looks like you deleted and re-added the calculating field, and spelled its name wrong the second time so the rules and condition are referencing invalid field names.  That's the main source of your problem.  Also, as I said, you should re-open the condition dialog and set up the condition using the dropdown boxes instead of having the expression entered in manually.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-25-2011 01:32 AM In reply to

    • dsfcom
    • Not Ranked
    • Joined on 08-22-2011
    • Posts 8

    Re: Use of Translate() Function in Multiple-Line Text Box

    Jimmy, PERFECT!  Thank you for that.  The question remains: which is the better method or are they both equally effective?

    Donald Fisher
  • 08-25-2011 04:09 AM In reply to

    Re: Use of Translate() Function in Multiple-Line Text Box

    Glad you worked it out.  To which two methods are you referring?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-25-2011 04:28 AM In reply to

    • dsfcom
    • Not Ranked
    • Joined on 08-22-2011
    • Posts 8

    Re: Use of Translate() Function in Multiple-Line Text Box

    In my second post i mentioned:

    "What I ended up doing which appears to be working well is two actions with the first setting text box 'calculating' = translate(., "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ") and the second setting 'UTM_UNIT_ADDRESS' to = 'calculating'."

    It seems to work well but I am wondering if this is just as good as the option you've been so graciously helping me with.

    Donald Fisher
  • 08-25-2011 06:47 AM In reply to

    Re: Use of Translate() Function in Multiple-Line Text Box

    Ah, sorry, I didn't notice that part.  It's puzzling that that works when your original attempt (just having the field set itself) didn't, since one would think they would produce the same result.  Just another one of InfoPath's quirks.

     I suggest using the approach I described because it's guaranteed to present an infinite loop error under any condition.  A while back, I discovered that if you have a field set itself to a blank value, it will cause an invinite loop in IP 2010, but not in 2007, so new quirks do have a way of cropping up.  My approach should help safeguard against that.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-25-2011 07:04 AM In reply to

    • dsfcom
    • Not Ranked
    • Joined on 08-22-2011
    • Posts 8

    Re: Use of Translate() Function in Multiple-Line Text Box

    Thanks again!  I'll switch my form to your method and spell the name of my field correctly this time.

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