Expand my Community achievements bar.

SOLVED

Unable to manage to iterate "change locale" for subrows

Avatar

Level 2

Hi All, I have managed an "Invoice template" similar to attached sample.

 

What I need is, each time I change currency (by related drop-down list) I need all instances locale to change set currency.

 

Change currency "drop down" includes neccessary script for the 1st row. However for sub-rows added by instance manager, it does not affect the locale change. 

 

If any one please help me to add neccesaary script to attached sample I can understrand easliy. 

 

Best Regards,

 

https://drive.google.com/file/d/19f1Iph4g880juw5cDvUIWhtORJRb-DWT/view?usp=sharing   

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 5

Try setting the local properties something like

var oFields = xfa.resolveNodes("form1.Table1.Row1[*]"); 
var nNodesLength = oFields.length; 
var nSum = 0; 
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) { 
    oFields.item(nNodeCount).UnitPrice.locale = "en_GB";
    oFields.item(nNodeCount).TotalPrice.locale = "en_GB";
} 	

Maybe create a function with the locale as a property, so you can reuse in your switch.

Also, there is 

form1.Table1.Footera.Subtotal.locale = "en_GB";

I don't see Footera anywhere on the form.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 5

Try setting the local properties something like

var oFields = xfa.resolveNodes("form1.Table1.Row1[*]"); 
var nNodesLength = oFields.length; 
var nSum = 0; 
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) { 
    oFields.item(nNodeCount).UnitPrice.locale = "en_GB";
    oFields.item(nNodeCount).TotalPrice.locale = "en_GB";
} 	

Maybe create a function with the locale as a property, so you can reuse in your switch.

Also, there is 

form1.Table1.Footera.Subtotal.locale = "en_GB";

I don't see Footera anywhere on the form.

Avatar

Level 2

Hi Moris, your suggested code did the trick. Thank you. 

 

Regarding: 

form1.Table1.Footera.Subtotal.locale = "en_GB";

that code should not be there. Mistakenly left as I simplified this "sample form" from an existing "main form". Please discard that.  

Avatar

Level 5

Awesome! Would be great to pin Moris's answer as correct.