ignore duplicate text when concatenating with double eval - InfoPath Dev Sign in | Join | Help in General InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » General » ignore duplicate text when concatenating with double eval ignore duplicate text when concatenating with double eval Last post 05-14-2014 03:28 PM by sposit. 13 replies. Page 1 of 1 (14 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 12-08-2010 11:14 AM rmsphoto Joined on 04-15-2010 Indianapolis Posts 25 ignore duplicate text when concatenating with double eval Reply Contact I have applied learning from the previous post http://www.infopathdev.com/forums/t/16943.aspx to concatenate several fields - works beautifully! But here's my new catch: This function is building a list of email address from various fields - up to 20+ recipients. It is very possible that the user will select the same person for several roles, therefore adding the same email to the string multiple times. Is there a way to prevent/ignore/remove duplicated field data in the final concatenated string? Thanks for any help, Filed under: Concat, double eval 12-13-2010 05:47 AM In reply to Patrick Halstead Joined on 08-08-2006 Posts 5,112 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Hi RMSPhoto, There's no way to filter out duplicates in the double eval. You may be able to filter them out in the form though by creating a separate hidden repeater that you set with the values of the first one. I can't think of how to do this right now, but there may be a way to limit it to unique values using rules. That's all I can think of though. Patrick HalsteadProject Manager at Qdabra 12-13-2010 07:00 AM In reply to rmsphoto Joined on 04-15-2010 Indianapolis Posts 25 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact I appreciate your taking the time to think about this, and post a reply. (Luckily, even with the same address listed multiple times, the user only receives a single email. - So it's not a biggie, anyway...) Thanks, again, 12-13-2010 07:47 AM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Could you show us what your formula is right now? I think I've found a way to accomplish this. Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software 12-13-2010 10:02 AM In reply to rmsphoto Joined on 04-15-2010 Indianapolis Posts 25 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Here is the current double eval formula: substring(eval(eval((EDG-EEEmail | EDG-MEEmail | EDG-DD1Email | EDG-PlasticsEmail | EDG-EETEmail | EDG-MTEmail | EDG-DD2Email | EDG-TWEmail)[. != ""], 'concat("; ", .)'), ".."), 3, 10000) Note: Each of the fields in this formula, may have multiple emails within, separated by "; ". These fields are built by straight rules. This is how the final concat'd string may contain 20+ emails, with possible repeats... example: 1) EDG-EEEmail = [email protected]; [email protected]; [email protected] 2) EDG-EETmail = [email protected]; [email protected] 3) [email protected]; [email protected] concat'd result = [email protected]; [email protected], [email protected]; [email protected]; [email protected]; [email protected]; [email protected] would like it to be instead = [email protected]; [email protected], [email protected]; [email protected]; [email protected] Thanks for your help! 12-13-2010 10:38 AM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Please give this a try substring(eval(eval((EDG-EEEmail | EDG-MEEmail | EDG-DD1Email | EDG-PlasticsEmail | EDG-EETEmail | EDG-MTEmail | EDG-DD2Email | EDG-TWEmail)[. != ""][not(. = preceding::*)], 'concat("; ", .)'), ".."), 3, 10000) That is, add [not(. = preceding::*)] after [. != ""] Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software 12-13-2010 11:18 AM In reply to rmsphoto Joined on 04-15-2010 Indianapolis Posts 25 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Very nice! This works perfectly when each field is identical, but it does not seek and destroy individual duplicate email addresses that are nested among different strings that are concat'd. e.g. works when field1="[email protected]", and field2 also = "[email protected]" result: [email protected] but does not work when field1="[email protected]; [email protected]", and field2="[email protected]; [email protected]" result:[email protected]; [email protected]; [email protected]; [email protected] (i.e. "[email protected]" is still duplicated) I think my request may not quite be feasible in a codeless world... Still - a very nice addition to the formula, that I will implement. Thanks, 12-13-2010 07:48 PM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Yes, I don't think it's going to be possible to come up with an expression to filter out duplicates from within the individual strings. How are the sub-lists getting formed? Are you using a separate double-eval for each of those? If so, it's probably possible to formulate the main double-eval to concatenate all of the e-mails without first assembling them into sub-lists. That would probably succeed in excluding all the duplicates. Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software 12-14-2010 06:34 AM In reply to rmsphoto Joined on 04-15-2010 Indianapolis Posts 25 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact The sub-lists are formed in 9 different fields (representing work disciplines). The user selects from a "people picker", or from a fixed list for each discipline; and the same personnel may be selected for multiple disciplines. Each of the nine sub-lists is built from using rules. So I don't think the double eval would work for those sub-lists... Again, I really appreciate your taking the time to help! 05-01-2014 10:58 AM In reply to sposit Joined on 05-01-2014 Posts 4 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Jimmy, can you revisit this with a bit simpler example please? I don't have the nested repeating fields, but still want to remove any duplicates. My aggregate formula looks like this:substring((eval(eval(FieldName, 'concat(., "; ")'), "..")), 0, (string-length(eval(eval(FieldName, 'concat(., "; ")'), "..")) - 1)) (The substring is merely to remove the final semicolon.) Thanks in advance! Tyler 05-07-2014 01:01 PM In reply to sposit Joined on 05-01-2014 Posts 4 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact So I tried this: substring((eval(eval(FieldName[not(. = preceding::*)], 'concat(., "; ")'), "..")), 0, (string-length(eval(eval(FieldName, 'concat(., "; ")'), "..")) - 1)) enabled form ... is this formulation not allowed in browser forms? Thanks, Tyler 05-13-2014 09:21 AM In reply to sposit Joined on 05-01-2014 Posts 4 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Correction: I can't seem to publish a web form with the formula above -- when publishing, I get an error that the form can only be published as a Filler form. Is this kind of formula not compatible with web forms? (This is in SharePoint Online, fwiw.) Thanks for any help you can provide. 05-13-2014 09:29 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Double eval is compatible with browser forms. What does the design checker say the issue is? Hilary Stoupa 05-14-2014 03:28 PM In reply to sposit Joined on 05-01-2014 Posts 4 Re: ignore duplicate text when concatenating with double eval Mark as Not AnswerMark as Answer... Reply Contact Double eval doesn't seem to be the issue -- it's the addition of the [not(. = preceding::*)]. The Design Checker doesn't actually say much of anything -- it only includes a couple items: 1) Data connections contain parameterized queries and 2) Could not verify the form template on the specified server. Strangely, when I revert back to the old version of the equation, the Design Checker then populates with a whole bunch of (mostly cosmetic) issues. The checker apparently can't even review the form template (error #2) while the updated equation is in place. Page 1 of 1 (14 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Hi RMSPhoto,
There's no way to filter out duplicates in the double eval. You may be able to filter them out in the form though by creating a separate hidden repeater that you set with the values of the first one. I can't think of how to do this right now, but there may be a way to limit it to unique values using rules. That's all I can think of though.
Could you show us what your formula is right now? I think I've found a way to accomplish this.
Please give this a try
substring(eval(eval((EDG-EEEmail | EDG-MEEmail | EDG-DD1Email | EDG-PlasticsEmail | EDG-EETEmail | EDG-MTEmail | EDG-DD2Email | EDG-TWEmail)[. != ""][not(. = preceding::*)], 'concat("; ", .)'), ".."), 3, 10000)
That is, add [not(. = preceding::*)] after [. != ""]
Yes, I don't think it's going to be possible to come up with an expression to filter out duplicates from within the individual strings.
How are the sub-lists getting formed? Are you using a separate double-eval for each of those? If so, it's probably possible to formulate the main double-eval to concatenate all of the e-mails without first assembling them into sub-lists. That would probably succeed in excluding all the duplicates.
Jimmy, can you revisit this with a bit simpler example please? I don't have the nested repeating fields, but still want to remove any duplicates. My aggregate formula looks like this:
substring((eval(eval(FieldName, 'concat(., "; ")'), "..")), 0, (string-length(eval(eval(FieldName, 'concat(., "; ")'), "..")) - 1))
(The substring is merely to remove the final semicolon.)
Thanks in advance!
Tyler
So I tried this: substring((eval(eval(FieldName[not(. = preceding::*)], 'concat(., "; ")'), "..")), 0, (string-length(eval(eval(FieldName, 'concat(., "; ")'), "..")) - 1))
enabled form ... is this formulation not allowed in browser forms?
Thanks,
Correction: I can't seem to publish a web form with the formula above -- when publishing, I get an error that the form can only be published as a Filler form. Is this kind of formula not compatible with web forms? (This is in SharePoint Online, fwiw.) Thanks for any help you can provide.
Double eval is compatible with browser forms. What does the design checker say the issue is?
Double eval doesn't seem to be the issue -- it's the addition of the [not(. = preceding::*)]. The Design Checker doesn't actually say much of anything -- it only includes a couple items: 1) Data connections contain parameterized queries and 2) Could not verify the form template on the specified server. Strangely, when I revert back to the old version of the equation, the Design Checker then populates with a whole bunch of (mostly cosmetic) issues. The checker apparently can't even review the form template (error #2) while the updated equation is in place.