InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error - 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 » InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error Last post 06-16-2017 09:14 AM by JcDenaes. 8 replies. Page 1 of 1 (9 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 06-15-2017 11:14 AM JcDenaes Joined on 04-12-2017 Canada Posts 4 InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error Reply Contact Hello, I am hitting an awkward bug. As anyone ever seen it and is there a way to get around it ? Thank you in advance! I have a field named # a01bc I have a working formula for the default value of this field # xdXDocument:GetDOM("sp-list-connection")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:list-column-requested[starts-with(../d:cycle, "1st-filter") and ../d:q3j5 = 1] I want to replace (end of the previous formula) # ../d:q3j5 = 1 with # ../d:q3j5 = number(substring(local-name(.), 2, 2)) where local-name(.) gives the name of the field, i.e. "a01bc" Per itself # number(substring(local-name(.), 2, 2)) is a working formula and returns 1 as expected Now if I put it in the main formula, what happens is this # xdXDocument:GetDOM("sp-list-connection")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:list-column-requested[starts-with(../d:1st-column, "data-as-filter") and ../d:2d-column = number(substring(local-name(.), 2, 2))] >> Error, Value type expected - Real Value: Number "[...] 2. -->2 So I played with the Modify an Xpath Expression CheckBox to have a better understanding (1) box checked, copy-paste # xdXDocument:GetDOM("sp-list-connection")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:list-column-requested[starts-with(../d:1st-column, "data-as-filter") and ../d:2d-column = number(substring(local-name(.), 2, 2))] >> 2, 2 (2) box unchecked # list-column-requested[starts-with(1st-column; "data-as-filter") and 2d-column = number(substring(local-name(.); 2; 2))] >> 2; 2 (2) box checked again # xdXDocument:GetDOM("sp-list-connection")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:list-column-requested[starts-with(../d:1st-column, "data-as-filter") and ../d:2d-column = number(substring(local-name(.), 2. 2))] >> 2. 2 Seeing this I tried different things, none are working - I tried to do it manually through infopath modal windows, error persists - I tried formula variations, all working in standalone but not int the main formula -- number(substring(local-name(.), "2", 2)) -- number(substring(local-name(.), number("2"), 2)) Those two variations allow the coma to stay a coma ( , > ; > , isntead of , > ; > . ) but no result is displayed nonetheless (verifiying the formula says it is fine in both cases) Why no output ? Is there a way to go around it ? Restrictions: IP 2013 w/ SP 2016 - Web form - no code allowed Any idea or advice ? Thanks in advance, Jean-Christophe Jc. 06-15-2017 03:56 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error Mark as Not AnswerMark as Answer... Reply Contact I think you just need to use current instead of "."? Did you try that? xdXDocument:GetDOM("sp-list-connection")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:list-column-requested[starts-with(../d:1st-column, "data-as-filter") and ../d:2d-column = number(substring(local-name(current()), 2. 2))] Hilary Stoupa 06-15-2017 06:37 PM In reply to JcDenaes Joined on 04-12-2017 Canada Posts 4 Re: InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error buggy_infopath_files.zip Mark as Not AnswerMark as Answer... Reply Contact Hi Hilary, Thank you for the prompt reply. I did the test and it goes from # local-name(current()), 2, 2)) to # local-name(current()), 2. 2)) Please, be aware that the "." as a relative path is not the issue, it is the coma as a parameter separator in the function substring(,,) which change in a point to become the erroneous function substring(,.) The second coma (,,) of the substring function is changing into a point (,.) when inserted in a request. Really odd. If someone can reproduce the behavior, it would be nice. Files in the zip attached - List template for SPsee PNG picture or you can use the manifest.xml and change "http://sp-dev/site_dev" by your SP site and convert the xml file in a .cab then a .stp (*) - xsn w/o connection (one has to add it once the local SP list is created) (*) https://chayadigital.wordpress.com/2011/08/05/manually-edit-a-stp-manifest-template-file-for-sharepoint/ Jc. 06-16-2017 08:38 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error Mark as Not AnswerMark as Answer... Reply Contact To be clear - once your formula is referencing a secondary data source, the relative path of "." is now relative to the secondary data source. I've not seen InfoPath change punctuation in a formula before. I'll take a look at your files. Hilary Stoupa 06-16-2017 08:48 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error scrn3.png Mark as Not AnswerMark as Answer... Reply Contact My column names were changed when I created a list from your template - so the formula looks a bit like gibberish, but here is a screenshot of this formula working without an issue for me. I'll attach my copy of the template in another reply. Hilary Stoupa 06-16-2017 08:50 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error buggy_infopath 20170616 HS.xsn Mark as Not AnswerMark as Answer... Reply Contact Here's the template with my formula in place. I wonder if the issue you are experiencing is perhaps a difference due to the language on your OS? Hilary Stoupa 06-16-2017 08:59 AM In reply to JcDenaes Joined on 04-12-2017 Canada Posts 4 Re: InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error Mark as Not AnswerMark as Answer... Reply Contact Thanks for the precision, I take good note. I tested again with my first variation, replacing the relative "." by "current()" as you have suggested and it is working # number(substring(local-name(current()), "2", 2)) gives # xdXDocument:GetDOM("sp-list-connection")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:list-column-requested[starts-with(../d:1st-column, "data-as-filter") and ../d:2d-column = number(substring(local-name(current()), "2", 2))] and is a working formula Note that I have to put the first parameter of the substring function between quotes and infopath stops changing the following coma into a point. So There is a bug and there is a way around. Thanks again Hilary for the hint, I did not saw that one. Much appreciated. (was writing while you were testing ;) just seen your last post, double checking is always good - thanks a lot) I have InfoPath in Both languages and it did occur in each (but I realized that the manifest maintain the language whith which the form is created - did change it for you yesterday) Clearly a bug in the parser and related to language management. In conclusion: For those whom are using a non-english infopath software use my variation # number(substring(local-name(current()), "2", 2)) else use Hilary's solution # number(substring(local-name(current()), 2, 2)) Thanks again! Jc. 06-16-2017 09:06 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error Mark as Not AnswerMark as Answer... Reply Contact Thank you for the follow up - interesting work around for the issue, but glad that quotes around the 2nd param of the substring function make it behave. :) Hilary Stoupa 06-16-2017 09:14 AM In reply to JcDenaes Joined on 04-12-2017 Canada Posts 4 Re: InfopPath bug - Substring(,,) in a GetDOM method has its last coma automatically converted in a point (,,) > (,.) = error Mark as Not AnswerMark as Answer... Reply Contact I totally agree! ^_^/~ Jc. Page 1 of 1 (9 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
I think you just need to use current instead of "."? Did you try that?
xdXDocument:GetDOM("sp-list-connection")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:list-column-requested[starts-with(../d:1st-column, "data-as-filter") and ../d:2d-column = number(substring(local-name(current()), 2. 2))]
To be clear - once your formula is referencing a secondary data source, the relative path of "." is now relative to the secondary data source. I've not seen InfoPath change punctuation in a formula before. I'll take a look at your files.