Setting defaults on some fields inadvertently sets similarly named fields in another repeating group - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

Last post 08-31-2018 08:19 AM by Hilary Stoupa. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 08-30-2018 05:15 AM

    Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

    I'm conufsed. I set the MmbId field to default to the value of a secondary data source (access table) using the following formula:
    xdXDocument:GetDOM("Payments_Current")/dfs:myFields/dfs:dataFields/d:Payments_Current[count(current()/../preceding::ns1:PmtInf) + 1]/@DbtrAgtMmbId
    
    			<ns1:DbtrAgt>
    				<ns1:FinInstnId>
    					<ns1:BIC></ns1:BIC>
    					<ns1:ClrSysMmbId>
    						<ns1:ClrSysId>
    							<ns1:Cd>CHBCC</ns1:Cd>
    						</ns1:ClrSysId>
    						<ns1:MmbId>233</ns1:MmbId>
    					</ns1:ClrSysMmbId>
    				</ns1:FinInstnId>
    			</ns1:DbtrAgt>
    
    But I don't set anything (default field is empty) for a similarly named field MmbId in a lower level (child) repeating group but when I run filler the same value appears in that field?
     
     				<ns1:CdtrAgt>
    					<ns1:FinInstnId>
    						<ns1:BIC></ns1:BIC>
    						<ns1:ClrSysMmbId>
    							<ns1:MmbId>233</ns1:MmbId>
    						</ns1:ClrSysMmbId>
    					</ns1:FinInstnId>
    				</ns1:CdtrAgt>
    
    How can this be and can anyone see what I'm doing worng?
    Krgds, Simon
  • 08-30-2018 08:09 AM In reply to

    Re: Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

    Do you have any rogue rules that might be causing this? Can you attach your form under the Options tab in a reply?
    Hilary Stoupa

  • 08-30-2018 08:39 AM In reply to

    Re: Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

    Hi Hilary, I added the xsn file to my original post. I don't have any rules at all. Btw, there is at least one other field where I similarly set the default and the same thing happens, i.e. another field with the same name but in a different repeating group gets set. Krgds, Simon
    Krgds, Simon
  • 08-30-2018 08:45 AM In reply to

    Re: Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

    Can you point me to where in the schema the fields in question are? You can right click them in the fields pane and select copy XPath and paste the XPath into a reply.
    Hilary Stoupa

  • 08-30-2018 09:03 AM In reply to

    Re: Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

    /ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:DbtrAgt/ns1:FinInstnId/ns1:ClrSysMmbId/ns1:MmbId
    
    /ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:CdtTrfTxInf/ns1:CdtrAgt/ns1:FinInstnId/ns1:ClrSysMmbId/ns1:MmbId
    
    
    Krgds, Simon
  • 08-30-2018 09:26 AM In reply to

    Re: Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

    How odd. This doesn't reproduce if I manually set the MmbId that currently has a default, or if I use a rule to set it. So, if I put these fields on the form, and preview the form, I won't get a default value because I don't have the DB that you are using, but if I manually enter info, the same-named fields in the other group aren't being set. Generally, I use references a lot in my schemas, and I've not seen this before with same-named fields. If you overwrite the default in MmbId with a different value, do the same-named fields change as well?
    Hilary Stoupa

  • 08-30-2018 11:00 AM In reply to

    Re: Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

    No, changing the MmbId field in filler doesn't change the same named field under CdtrAgt. I could only tell this by saving the form and checking the xml because, if you look at the template, you'll see the MmbId field under the CdtrAgt tag isn't even on the form. I think there must be something strange going wrong during the default setting and there seems to be 3 fields inadvertently set as follows:
    Field:		/ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:DbtrAgt/ns1:FinInstnId/ns1:ClrSysMmbId/ns1:ClrSysId/ns1:Cd
    Default value:	xdXDocument:GetDOM("Payments_Current")/dfs:myFields/dfs:dataFields/d:Payments_Current[count(current()/../preceding::ns1:PmtInf) + 1]/@DbtrAgtCd
    Set in error:	/ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:CdtTrfTxInf/ns1:CdtrAgt/ns1:FinInstnId/ns1:ClrSysMmbId/ns1:ClrSysId/ns1:Cd
    
    Field:		/ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:DbtrAgt/ns1:FinInstnId/ns1:ClrSysMmbId/ns1:MmbId
    Default value:	xdXDocument:GetDOM("Payments_Current")/dfs:myFields/dfs:dataFields/d:Payments_Current[count(current()/../preceding::ns1:PmtInf) + 1]/@DbtrAgtMmbId
    Set in error:	/ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:CdtTrfTxInf/ns1:CdtrAgt/ns1:FinInstnId/ns1:ClrSysMmbId/ns1:MmbId
    
    Field:		/ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:CdtTrfTxInf/ns1:CdtrAcct/ns1:Id/ns1:Othr/ns1:Id
    Default value:	xdXDocument:GetDOM("Payments_Current")/dfs:myFields/dfs:dataFields/d:Payments_Current[count(current()/../preceding::ns1:CdtTrfTxInf) + 1]/@CdtrAcctId
    Set in error:	/ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:CdtTrfTxInf/ns1:CdtrAgt/ns1:FinInstnId/ns1:Othr/ns1:Id
    
    
    Note that I have 7 instances of repeating group CdtTrfTxInf in the form. The resulting xml is a little more complicated in that the first field set in error above, Cd, only occurs for the first instance of CdtTrfTxInf and the last one above, Id, does NOT occur for the first instance CdtTrfTxInf. The 2nd field above, MmbId, is always set in error. The problem always occurs under the CdtrAgt tag. I can't send you my access table because that's private but if you like I can send you a sample database?
    Krgds, Simon
  • 08-31-2018 02:55 AM In reply to

    Re: Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

    I found one other field that was being set inadvertently:
    Field:                    /ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:DbtrAcct/ns1:Id/ns1:IBAN
    Default value:       xdXDocument:GetDOM("Payments_Current")/dfs:myFields/dfs:dataFields/d:Payments_Current[count(current()/../preceding::ns1:PmtInf) + 1]/@DbtrAcctIBAN
    Set in error:         /ns1:Document/ns1:CstmrCdtTrfInitn/ns1:PmtInf/ns1:ChrgsAcct/ns1:Id/ns1:IBAN
    
    and it's not under the CdtrAgt tag. As a workaround I've set up a form load rule and set all the fields being wrongly set to null and the result is what I wanted so that works for my purposes. It would imply the errors occur while setting defaults but before the load rules occur.
    Krgds, Simon
  • 08-31-2018 08:19 AM In reply to

    Re: Setting defaults on some fields inadvertently sets similarly named fields in another repeating group

    Good work around - like I said, I've never seen this before, but your schema is rather complex, and it could be you found an InfoPath bug. :)
    Hilary Stoupa

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