InfoPath 2010 - Rule Formula with concat of many fields - Need Help in the appended portion - 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 » InfoPath 2010 - Rule Formula with concat of many fields - Need Help in the appended portion InfoPath 2010 - Rule Formula with concat of many fields - Need Help in the appended portion Last post 01-13-2015 07:29 AM by Hilary Stoupa. 5 replies. Page 1 of 1 (6 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 01-07-2015 09:17 AM SRAEngineer Joined on 01-07-2015 Posts 22 InfoPath 2010 - Rule Formula with concat of many fields - Need Help in the appended portion Reply Contact I have an Application Form going to a SharePoint 2010 Form Library. The Final ApplicationID is populated when User clicks "Yes" radio button stating that he/she is ready to submit.The Textbox control for the ApplicationID should look like this: 2015C-02-025b1.Here are the rules:2015 = current yearC or L = Application Type (Depends on the view and a control as well as field for the type)02 = College ID (there 14 IDs and comes from its field)025 = Individual Sequential Application ID per year (I have not figured that part out yet! But, it is for a later study and implementation!...)b = If project is bundled, else blank (If bundledproj is selected to "Yes" from a dropdown, then append b, else blank)1 = Bundled Project ID (1 to 10 max). If project is bundled then append its ProjectID here else, blank!This is what I have so far... concat(number(substring(appdate, 1, 4)), (substring(apptype, 1, 1)), "-", collegeid, "-025", (substring(“b”, 1, (bundledproj = 1)*string-length(“b”)), substring(“”, 1, (bundledproj = 0)*string-length(“”)))The Bolded part works. The "b" part formula does not. (it is based on method 2 of this post: http://blogs.msdn.com/b/infopath/archive/2006/11/27/conditional-default-values.aspx)Any help is appreciated! Filed under: Infopath 2010 form conditional formula 01-09-2015 04:03 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: InfoPath 2010 - Rule Formula with concat of many fields - Need Help in the appended portion Mark as Not AnswerMark as Answer... Reply Contact So - bundledproj - is that the ID? Or is that a Boolean value? Your description says it might be Yes, but your formula seems to expect 1 or 0. And I don't see the bundled project ID in the formula.... Maybe: substring(concat("b", BundledProjectID), 1, (bundledproj = "Yes") * string-length(concat("b", BundledProjectID))) You'll have to use the field picker to pick the fields. I don't think you need another substring for if it is not bundled, since you aren't adding anything in that case? Hilary Stoupa 01-12-2015 05:59 AM In reply to SRAEngineer Joined on 01-07-2015 Posts 22 Re: InfoPath 2010 - Rule Formula with concat of many fields - Need Help in the appended portion Mark as Not AnswerMark as Answer... Reply Contact Thank you Hillary for taking time to look into this. bundledproj is a Boolean field with 0 and 1 value. projid is a field name for a Bundled Project ID Number. I used your approach and let the filed picker picked the suggested fields. My formula now looks like this.concat(number(substring(appdate, 1, 4)), (substring(apptype, 1, 1)), "-", collegeid, "-025"), (substring(concat("b", projectid), 1, (bundledproj = "1") * string-length(concat("b", projectid)))) However, the InfoPath system is showing error at the comma after 025 as shown below: (Is there a limit as how many characters you can concat?) Expected value type: end-of-stringActual value: ,concat(number(substring(../../my:generalinfo/my:application/my:appdate, 1, 4)), (substring(../../my:generalinfo/my:application/my:apptype, 1, 1)), "-", ../../my:generalinfo/my:submitter/my:collegeid, "-025")-->,<-- (substring(concat("b", ../../my:projectdetails/my:proposedproject/my:projectid), 1, (../../my:generalinfo/my:application/my:bundledproj = "1") * string-length(concat("b", ../../my:projectdetails/my:proposedproject/my:projectid)))) BTW, I did a workaround by splitting the formula in various rules during the weekend, but if you have the solution to the above, I like to learn.My workaround was to create another rule and concat b3 to the previously calculated appID. Where b if for the bundled project and 3 is the projID. Also, added a third rule to get the appID with the formula without b3 in case when the project is not bundled.Thanks again! 01-12-2015 07:27 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: InfoPath 2010 - Rule Formula with concat of many fields - Need Help in the appended portion Mark as Not AnswerMark as Answer... Reply Contact Well - in the above formula, you have the closing parenthesis for the concat statement after "025". I don't know of any limits on concat. Hilary Stoupa 01-12-2015 02:34 PM In reply to SRAEngineer Joined on 01-07-2015 Posts 22 Re: InfoPath 2010 - Rule Formula with concat of many fields - Need Help in the appended portion Mark as Not AnswerMark as Answer... Reply Contact Thank You! Hillary. The formula works great when bundledproj = 1 and I appreciate it. However, no appid appears when bundledproj = 0...Another words, if bundledproj = 1, the appID should look like 2015C-11-002b3 and if bundledproj = 0, the appID should look like 2015-11-002. Formula that works when bundledproj = 1 is: concat(number(substring(appdate, 1, 4)), (substring(apptype, 1, 1)), "-", collegeid, "-025", (substring(concat("b", projectid), 1, (bundledproj = "1") * string-length(concat("b", projectid))))) Above formula does not work when bundledproj = 0, and the one I am trying that gives me an error is: concat(number(substring(appdate, 1, 4)), (substring(apptype, 1, 1)), "-", collegeid, "-025", (substring(concat("b", projectid), 1, (bundledproj = "1") * string-length(concat("b", projectid)))), (substring((" "), 1, (notbundledproj = "1")) * string-length(" ")))Any idea how to resolve this?Perhaps a separate rule? 01-13-2015 07:29 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: InfoPath 2010 - Rule Formula with concat of many fields - Need Help in the appended portion Mark as Not AnswerMark as Answer... Reply Contact So - what is the result of the formula that works when bundledproj=1 when bundledproj is not 1? I'm confused about the -025 in the formula as well, as it doesn't appear to be part of your desired results. Hilary Stoupa Page 1 of 1 (6 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
I have an Application Form going to a SharePoint 2010 Form Library. The Final ApplicationID is populated when User clicks "Yes" radio button stating that he/she is ready to submit.
The Textbox control for the ApplicationID should look like this: 2015C-02-025b1.
Here are the rules:
2015 = current year
C or L = Application Type (Depends on the view and a control as well as field for the type)
02 = College ID (there 14 IDs and comes from its field)
025 = Individual Sequential Application ID per year (I have not figured that part out yet! But, it is for a later study and implementation!...)
b = If project is bundled, else blank (If bundledproj is selected to "Yes" from a dropdown, then append b, else blank)
1 = Bundled Project ID (1 to 10 max). If project is bundled then append its ProjectID here else, blank!
This is what I have so far...
concat(number(substring(appdate, 1, 4)), (substring(apptype, 1, 1)), "-", collegeid, "-025", (substring(“b”, 1, (bundledproj = 1)*string-length(“b”)), substring(“”, 1, (bundledproj = 0)*string-length(“”)))
The Bolded part works. The "b" part formula does not. (it is based on method 2 of this post: http://blogs.msdn.com/b/infopath/archive/2006/11/27/conditional-default-values.aspx)
Any help is appreciated!
So - bundledproj - is that the ID? Or is that a Boolean value? Your description says it might be Yes, but your formula seems to expect 1 or 0. And I don't see the bundled project ID in the formula....
Maybe:
substring(concat("b", BundledProjectID), 1, (bundledproj = "Yes") * string-length(concat("b", BundledProjectID)))
You'll have to use the field picker to pick the fields. I don't think you need another substring for if it is not bundled, since you aren't adding anything in that case?
Thank you Hillary for taking time to look into this. bundledproj is a Boolean field with 0 and 1 value. projid is a field name for a Bundled Project ID Number. I used your approach and let the filed picker picked the suggested fields. My formula now looks like this.
concat(number(substring(appdate, 1, 4)), (substring(apptype, 1, 1)), "-", collegeid, "-025"), (substring(concat("b", projectid), 1, (bundledproj = "1") * string-length(concat("b", projectid))))
However, the InfoPath system is showing error at the comma after 025 as shown below: (Is there a limit as how many characters you can concat?)
Expected value type: end-of-string
Actual value: ,concat(number(substring(../../my:generalinfo/my:application/my:appdate, 1, 4)), (substring(../../my:generalinfo/my:application/my:apptype, 1, 1)), "-", ../../my:generalinfo/my:submitter/my:collegeid, "-025")-->,<-- (substring(concat("b", ../../my:projectdetails/my:proposedproject/my:projectid), 1, (../../my:generalinfo/my:application/my:bundledproj = "1") * string-length(concat("b", ../../my:projectdetails/my:proposedproject/my:projectid))))
BTW, I did a workaround by splitting the formula in various rules during the weekend, but if you have the solution to the above, I like to learn.
My workaround was to create another rule and concat b3 to the previously calculated appID. Where b if for the bundled project and 3 is the projID. Also, added a third rule to get the appID with the formula without b3 in case when the project is not bundled.
Thanks again!
Well - in the above formula, you have the closing parenthesis for the concat statement after "025". I don't know of any limits on concat.
Thank You! Hillary.
The formula works great when bundledproj = 1 and I appreciate it. However, no appid appears when bundledproj = 0...
Another words, if bundledproj = 1, the appID should look like 2015C-11-002b3 and if bundledproj = 0, the appID should look like 2015-11-002.
Formula that works when bundledproj = 1 is: concat(number(substring(appdate, 1, 4)), (substring(apptype, 1, 1)), "-", collegeid, "-025", (substring(concat("b", projectid), 1, (bundledproj = "1") * string-length(concat("b", projectid)))))
Above formula does not work when bundledproj = 0, and the one I am trying that gives me an error is: concat(number(substring(appdate, 1, 4)), (substring(apptype, 1, 1)), "-", collegeid, "-025", (substring(concat("b", projectid), 1, (bundledproj = "1") * string-length(concat("b", projectid)))), (substring((" "), 1, (notbundledproj = "1")) * string-length(" ")))
Any idea how to resolve this?
Perhaps a separate rule?
So - what is the result of the formula that works when bundledproj=1 when bundledproj is not 1? I'm confused about the -025 in the formula as well, as it doesn't appear to be part of your desired results.