Hello team,
I am naive to Adobe live cycle designer, apologies if it is a a very basic question.
A segment in my invoice XML keeps repeating, but the identifier and the amount keep changing for every occurence of taxsummary. Example as below the target fields in my adobe form have to populated based on the <Ident> field, if it GST put <TaxableAmount> to TAX_GST, if it PST put <TaxableAmount> to TAX_PST.
<TaxSummary>
<Tax>
<TaxTypeCodedOther>
<Identifier>
<Agency>
<AgencyCoded>Other</AgencyCoded>
<AgencyCodedOther>GST</AgencyCodedOther>
</Agency>
<Ident>GST</Ident>
</Identifier>
<TaxableAmount>52500.00</TaxableAmount>
</TaxTypeCodedOther>
</Tax>
</TaxSummary>
<TaxSummary>
<Tax>
<TaxTypeCodedOther>
<Identifier>
<Agency>
<AgencyCoded>Other</AgencyCoded>
<AgencyCodedOther>GST</AgencyCodedOther>
</Agency>
<Ident>PST</Ident>
</Identifier>
<TaxableAmount>9500.00</TaxableAmount>
</TaxTypeCodedOther>
</Tax>
</TaxSummary>
<TaxSummary>
<Tax>
<TaxTypeCodedOther>
<Identifier>
<Agency>
<AgencyCoded>Other</AgencyCoded>
<AgencyCodedOther>GST</AgencyCodedOther>
</Agency>
<Ident>HST</Ident>
</Identifier>
<TaxableAmount>1500.00</TaxableAmount>
</TaxTypeCodedOther>
</Tax>
</TaxSummary>
I managed to write something like this on the calculate event:
if (xfa.datasets.data.Invoice.InvoiceSummary.ListOfTaxSummary.TaxSummary[0].Tax.TaxTypeCodedOther.Identifier.Ident == "HST")
then
this.rawValue = xfa.datasets.data.Invoice.InvoiceSummary.ListOfTaxSummary.TaxSummary[0].Tax.TaxAmount
elseif (xfa.datasets.data.Invoice.InvoiceSummary.ListOfTaxSummary.TaxSummary[1].Tax.TaxTypeCodedOther.Identifier.Ident == "HST")
then
this.rawValue = xfa.datasets.data.Invoice.InvoiceSummary.ListOfTaxSummary.TaxSummary[1].Tax.TaxAmount
elseif (xfa.datasets.data.Invoice.InvoiceSummary.ListOfTaxSummary.TaxSummary[2].Tax.TaxTypeCodedOther.Identifier.Ident == "HST")
then
this.rawValue = xfa.datasets.data.Invoice.InvoiceSummary.ListOfTaxSummary.TaxSummary[2].Tax.TaxAmount
elseif (xfa.datasets.data.Invoice.InvoiceSummary.ListOfTaxSummary.TaxSummary[3].Tax.TaxTypeCodedOther.Identifier.Ident == "HST")
then
this.rawValue = xfa.datasets.data.Invoice.InvoiceSummary.ListOfTaxSummary.TaxSummary[3].Tax.TaxAmount
endif
trying to get this working with a foreach statement but does not seem to work, can anyone please suggest the solution using the foreach statement or something is JavaScript is also helpful..
Thanks,
harry..
Views
Replies
Total Likes
Hello Harry,
Try the below syntax and replace your code.
this is in formcalc.
var List = ref(xfa.record.Invoice.InvoiceSummary.ListOfTaxSummary.TaxSummary)
for i=0 upto List.nodes.length - 1 step 1 do
$.rawValue = List.nodes.item(i).Tax.TaxAmount.value
endfor
Or the syntax for foreach you can use is:
var total = 0.0
foreach expense in ( travel_exp[*], living_exp[*],parking_exp[*] ) do
total = total + expense
endfor
Hope this helps.
Regards,
Chaitanya
Views
Replies
Total Likes
Hi Chaitu,
Thanks for your response, still getting the error as enclosed. Also can you please elaborate the foreach statement you provided earlier.
Harry
Views
Replies
Total Likes
May be the syntax is wrong. Instead of xfa.data.record...
can you try on this similar lines:
xfa.datasets.data.purchaseOrder.general.poNum.value
my xml data structure is something similar to this:
Hi Chaitanya,
I wrote something like this and it worked.
var List = ref(xfa.datasets.data.Invoice.InvoiceSummary.ListOfTaxSummary)
var value
for i=0 upto List.nodes.length - 1 step 1 do
if (List.nodes.item(i).Tax.TaxTypeCodedOther.Identifier.Ident.value == "QST")
then
value = List.nodes.item(i).Tax.TaxAmount.value
endif
endfor
$.rawValue = value
Views
Replies
Total Likes