Formula for Separator in Text Box with Concatenated Fields - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Formula for Separator in Text Box with Concatenated Fields

Last post 12-07-2010 01:09 PM by rmsphoto. 33 replies.
Page 2 of 3 (34 items) < Previous 1 2 3 Next >
Sort Posts: Previous Next
  • 10-03-2010 07:16 AM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    Sorry, thought you wouldn't be able to open it either and it wouldn't do any good to forward.  Attached is one of the practice forms with the formula in it.  Thanks.

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

    Re: Formula for Separator in Text Box with Concatenated Fields

    The form opened fine in design mode, but refused to open in preview mode.

    It looks like InfoPath has a problem with using the [. = ''] filtering in an eval() expression for a default value with the Automatically Recalculate option selected.

    I've worked around this by having each of fields 1-5 set field6 to the value "recalc" when one of them changes value, and then a rule on field6 to set its own value using the formula when its value is changed to "recalc."  Seems to work.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-03-2010 01:31 PM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    Yes!  This works!  Worked on a practice form and then on a form with more true to life (numerous) selections, so I am sure I can now apply it to the real form.  Thank you very very much!

    Nalani

  • 10-03-2010 06:41 PM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    After I began applying the formula to my real form, I've run into a problem that doesn't make sense.  The same formula works just fine on one section of options, but applying it the exact same way on another section gives me different results.  I've re-done it several times and even limited it to only 3 items just to see if I'd get the same results and I do.  It is adding commas in without an item.  If all items are there, it looks like it's supposed to, but if any item is not, then there's just a bunch of commas.  For example:

    Item1, , ,

    Item1, Item2, ,

    Item1, Item2, Item3

    Do you have any idea why the formula would behave differently in two different sections?  Both sections are using checkboxes and populating a text box.  I've applied the Rules the same way in both places.  I'm really at a loss as to why this would happen.  I'd attach the form but it's too large. 

  • 10-03-2010 07:03 PM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    Is there any chance the checkboxes in that section have blank spaces in the unchecked value?  Could you post your formula?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-03-2010 07:16 PM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    The unchecked values do not have a space in them. Here's the formula:

    substring(eval(eval((AirTopicsHide1 | AuditDiscloseHide1 | BBEnvSeminarsHide1 | BankruptcyHide1)[. != ""], 'concat(", ", .)'), ".."), 3, 10000)

  • 10-03-2010 07:28 PM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    I just tried another section and the formula worked just fine.  There must be something else unusual in the section where I'm having trouble.  I will continue looking into that. There wouldn't be a problem with a large number of fields in the formula (like 30 or 50) as far as you know would there?

     

  • 10-03-2010 07:42 PM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    No problem that I know of, but I've never tried the formula with more than a few fields.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-03-2010 08:32 PM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    Jimmy -- I just applied the formula to another section that is identical to the one I'm having the trouble with - there are 30 fields in it just like the other one; this one worked like a charm, confirming that the problem with that other section is unrelated to the formula. So, again, I want to say thank you very much.  You have been a huge help with a monster of a form I've had to put together in which adding a separator in several locations was in big demand.  Thank you for all of your time and attention to my problem.  I feel sure now I can get the form wrapped up, even if I have to redo that one section.

    Nalani

  • 10-03-2010 10:07 PM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    Glad to help, and I hope you figure out this last problem.  If you still can't get it after a while of troubleshooting, you can e-mail the form to me at james dot rishe at qdabra dot com, and I can have a look.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-04-2010 07:52 AM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    I did finally get that other section to work by removing the formula and starting over -- there must have been one little thing off in the way I had added it the first time.  But thankfully it is working perfectly now!  Unfortunatley, there is one more issue I'm having.  One section that has multiple check boxes has a final check box that is "Other" and when checked will open a section holding a text box to the right for a user to fill in anything that is not able to be categorized in the other check boxes provided.  When I apply the formula to this section, all check boxes work as they should, and when deselected the value disappears from the text box where the formula is applied.  If I fill out the "Other" text box with anything and it gets added to the text box with the formula, the text gets added just fine, but if I deselect the check box that controls the "Other" text box, the text that was entered does not disappear from the text box with the formula.  I will recreate a facsimile here:

    Check box1 (Field1=Apple)
    Check box2 (Field2=Orange)
    Check box3 (Field3=Banana)
    Check box4 (Field4=Grape)
    Check box5 (Field5=Other)               Other Text box (conditional formatting set to hide unless Field5 has been checked) (Field6=blank)

    Text box with formula:  substring(eval(eval((field1 | field2 | field3 | field4 | field6)[. !=""], 'concat(", ",.)'), ".."), 3, 1000)

    Results when all boxes checked on Text box with formula:  Apple, Orange, Banana, Grape, Text typed in Field6

    Deselect Field4 (user made a mistake):  Apple, Orange, Banana, Text typed in Field6

    Deselect Field5 that controls Field6:  Apple, Orange, Banana, Text typed in Field6

    Once data is typed in Field6, it stays in the Text box with the formula.

    If it would be helpful, I could send you a copy of my form as you mentioned in your last email, just let me know.  But I thought I'd first try to relay it this way so you wouldn't have to wade through my form.  I promise if you can help me with this I really believe this will be the final problem with separators I'm having on this form.  And again, thank you.

    Nalani

  • 10-04-2010 08:37 AM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    How's this:

    substring(eval(eval((field1 | field2 | field3 | field4 | field6[field5 != ""])[. !=""], 'concat(", ",.)'), ".."), 3, 1000)

    The other option is to put a rule on field5 to reset field6's value when field5 is unchecked, but depending on your design, you may or may not want to retain the value in field6 in case the user checks field5 again.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-04-2010 09:13 AM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    I tried this edit to the formula, but field6 text still stuck in the formula text box.  Then I tried adding a Rule to field5 to reset field6, but the field6 text still stuck.  The odd thing is if I deselect field5 and then select any other check box, then the field6 text in the formula text box goes away.  But if I don't check another check box, it remains.  I also tried it with both the formula edited like above and with field5 having the Rule about resetting field6 but it still behaved the same.

     

  • 10-04-2010 09:23 AM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    ncarson:
    The odd thing is if I deselect field5 and then select any other check box, then the field6 text in the formula text box goes away.  But if I don't check another check box, it remains.

     This probably means that you need to rearrange the order of your rules on field5.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-04-2010 10:08 AM In reply to

    Re: Formula for Separator in Text Box with Concatenated Fields

    I have only one Rule on field5:  Condition:  field5 is blank  Action:  Set field6 = ""

    Field6 has conditional formatting to hide if field5 is cleared.

     

Page 2 of 3 (34 items) < Previous 1 2 3 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.