Adobe form, count number of elements in a subform with JS

Adobe form, count number of elements in a subform with JS

The goal here is to define of there are data into the table, if not, we hide the subform. That means, we hide the whole table (border and header line).
There are several ways to proceed, this is one :

Table from context is binded like :

  • TABLE_TEXT_HEADER_PO binded with $.TABLE_HEADER
  • LINE_TEXT_HEADER_PO binded with $.DATA[*] (repeat subform for each data item is ticked)
  • HEADER_PO_TEXT binded with $.TEXT_CONTENT

If there is no data into table, only 3 elements will be displayed : TABLE_TEXT_HEADER_PO, LABEL_HEADER_TEXTS and LINE_TEXT_HEADER_PO. Element HEADER_PO_TEXT will not be displayed has there is no data.
Number of Elements is 3.

If there is 1 entry into table $.TABLE_HEADER, this time element HEADER_PO_TEXT will be displayed.
Number of Elements is now 4.

This is enough to check with javascript if we display or not the table :


// data.Main.MAIN_HEADER.TABLE_TEXT_HEADER_PO::ready:form - (JavaScript, server)
var count = TABLE_TEXT_HEADER_PO.nodes.length;
if (count < 4){
	this.presence = "hidden";
}

About the author

fjourneau administrator

Hi, I'm Florian Journeau, SAP ABAP R3 Freelance, based in Toulouse, France. You want to know more about me, have a look on my CV : cv.fjourneau.net.

1 Comment so far

Cristian PeirettiPosted on11:16 pm - Jan 14, 2022

Hello fjourneau.
Sorry for bother you. I am bulding a form wich requeriment is the table only show 10 position for page.
If posible that?.
My problem is the BPO not want the totals and footer show in each page. Only in the last page.-
Regards

Leave a Reply