Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Needing help on script FormcCal or Java

SUANG
Level 1
Level 1

Hi,

 

I'm new to Adobe forms and am struggling to write the script for the requirement needed. Any pointers/help would be greatly

appreciated.

 

Requirement: Only want to display rows that DocumentReferenceID value starts with "009". Note that there will be a total for the amount which starts with "009".

 

Sample data of rowItemsNode table:-

DocumentReferenceIDddtlDocumentDatetxtTransactionCurrencydecAmountInTransactionCurrency
00900126/05/2021USD100
00900227/05/2021USD100
14000128/05/2021USD300

 

rowItemsNode table 

SUANG_0-1629965077434.png

 

Output that I want:-

DocumentReferenceIDddtlDocumentDatetxtTransactionCurrencydecAmountInTransactionCurrency
00900126/05/2021USD100
00900227/05/2021USD100
Total   200

 

Is the script below correct?

if (Left(Form.bdyMain.frmItems.tblItems.rowItemsNode[*].DocumentReferenceID, 3) == "009");
{
tblItems._rowItemsNode.removeInstance(true); 
xfa.form.recalculate(true); 
}

 

Many thanks in advance!!

1 Accepted Solution
radzmar
Correct answer by
Level 10
Level 10

You can use conditional bindings with predicates so you won't need any scripting.

Given your table row "rowItemsNode" now has a binding like $.tableData.rowData[*] you can use a predicate statement within the brackets to filter the data directly when it's merged with template to the form you get rendered on screen.

 

$.tableData.rowData.[Left($.DocumentReferenceID, 3) eq "009"]

 

View solution in original post

2 Replies
Arun_Patidar
Community Advisor
Community Advisor

Hi,

You should post this in dedicated AEM Form community to get faster response.

Please check the AEM Forms guide if that help.

AEM Form Community - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-forms/ct-p/adobe-experienc... 

Guide - https://helpx.adobe.com/pdf/aem-forms/6-2/formcalc-reference.pdf

 

radzmar
Correct answer by
Level 10
Level 10

You can use conditional bindings with predicates so you won't need any scripting.

Given your table row "rowItemsNode" now has a binding like $.tableData.rowData[*] you can use a predicate statement within the brackets to filter the data directly when it's merged with template to the form you get rendered on screen.

 

$.tableData.rowData.[Left($.DocumentReferenceID, 3) eq "009"]

 

View solution in original post