Double eval with substring - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Double eval with substring

Last post 01-18-2019 12:40 PM by Wheels. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 08-30-2017 07:21 AM

    Double eval with substring

     Hi all,

     Relatively new to all this InfoPath stuff and royally stuck on combining double eval when I have substring included in a formula already! 

    What I'm trying to do is send emails to multiple people from a people picker. I can get it to send to the first person, by taking the last part of the Account ID and using this to send the email, but I can't get it to send to the other users who will be entered in the picker. I've read all about double eval but can't work out how to combine the two.

    This is what I have so far for substring... just need some help if possible with combining this with a double eval?

    substring-after(AccountId, "GLOBAL\")  

    Thanks! 

  • 08-30-2017 01:03 PM In reply to

    Re: Double eval with substring

     So, one way to set up a double eval looks like this:

    eval(eval(AccountId, 'concat(., ";")'), "..")

    Use the button for select a field or group to select the AccountId node.

    Then for your enhancement:

     eval(eval(AccountId, 'concat(substring-after(., "GLOBAL\"), ";")'), "..")

    Hilary Stoupa

  • 08-30-2017 01:24 PM In reply to

    Re: Double eval with substring

    Hi - I am looking for help with something similar. I am currently doing a double eval to pull back "Display Name" on multiple values from a list.. but that pulls back more than just the users name (Example: Mickey Mouse, profile url, Department, etc) I need to now split up the multiple values (or user names) in to a seperate textbox I can get it to show me 1 name by using this as default value for the second text box: substring-before(OPAckNeeded, ",") which delivers Mickey Mouse. I need to be able to do a double eval on this to show all the names with a comma between (Mickey Mouse, Donald Duck, etc) Any help much appreciated!
  • 08-31-2017 06:43 AM In reply to

    Re: Double eval with substring

    I ended up figuring it out based on your example - thanks for posting!
  • 01-18-2019 08:13 AM In reply to

    Re: Double eval with substring

    Good morning.

    I have been successfully using the Person/Group Picker control for a while now with the following:

    eval(eval(DisplayName, 'concat(., ";")'), "..")

    I ran into an issue where this would fail if 2 individuals have the same name. So I am try to go with the AccountId. I created the following to user the user name minus the domain prefix:

    eval(eval(substring-after(AccountId,"UP\"), 'concat(., ";")'), "..")

    but I am coming up with a  Type mismatch - Error occurred during a call to property or method 'Eval'.

    Any suggestions or thoughts? 

    WHEELS

  • 01-18-2019 09:07 AM In reply to

    Re: Double eval with substring

    I tried the following, but it only resolves the 1st name when emailing:

    concat(substring-after(AccountId, "UP\"), ";")

    WHEELS 

  • 01-18-2019 09:40 AM In reply to

    Re: Double eval with substring

    I think you need to move the substring part of the formula: eval(eval(AccountId, 'concat(substring-after(.,"UP\"), ";")'), "..")
    Hilary Stoupa

  • 01-18-2019 09:59 AM In reply to

    Re: Double eval with substring

    Hi Hilary.

    I will give that a try. I did find the following, and although it looked promising, I am getting an error:

     Unexpected character.
    substring(eval(eval(my:group/pc:Person, -->‘<--concat(pc:my:group/pc:Person/pc:AccountId, “;”)’), “..”), 1, string-length(eval(eval(my:group/pc:Person, ‘concat(pc:my:group/pc:Person/pc:AccountId, “;”)’), “..”)) – 1)  

    https://mysharepointpage.wordpress.com/2014/07/14/using-eval-function-for-people-picker-in-infopath/
    substring(eval(eval(Person, ‘concat(pc:AccountId, “;”)’), “..”), 1, string-length(eval(eval(Person, ‘concat(pc:AccountId, “;”)’), “..”)) – 1) 

    WHEELS 

  • 01-18-2019 10:03 AM In reply to

    Re: Double eval with substring

    Hi Hilary. I tried your simple, but brilliant expression and it worked as expected. You saved the day once again. Thank you very much. WHEELS.

  • 01-18-2019 12:16 PM In reply to

    Re: Double eval with substring

    Happy to help. Here's what's happening - the place where you select the field (AccountID) is what gets all the repeating nodes. Then, any formulas you want to apply to the text (like the concat, to add the ";" or the substring-after) go in the single quotes. Here's a good explanation of double eval: https://blogs.msdn.microsoft.com/infopath/2006/04/05/email-submit-to-line-loops-in-formulas/
    Hilary Stoupa

  • 01-18-2019 12:40 PM In reply to

    Re: Double eval with substring

     Thanks again. I hope I will have the opportunity to help you sometime and repay the favor. WHEELS

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