<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: AdobeForms - count entries in table (JavaScript) in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/adobeforms-count-entries-in-table-javascript/qaa-p/12461224#M4667541</link>
    <description>&lt;P&gt;First of all change layouts.ready -&amp;gt; Events with script.&lt;/P&gt;&lt;P&gt;Write down the below code.-&lt;/P&gt;&lt;P&gt;xfa.resolveNode("GV_ITEM_COUNT").rawValue = xfa.resolveNodes("$record.IT_PO_ITMEMS.DATA[*]").length&lt;/P&gt;</description>
    <pubDate>Sun, 27 Jun 2021 07:57:08 GMT</pubDate>
    <dc:creator>former_member753791</dc:creator>
    <dc:date>2021-06-27T07:57:08Z</dc:date>
    <item>
      <title>AdobeForms - count entries in table (JavaScript)</title>
      <link>https://community.sap.com/t5/technology-q-a/adobeforms-count-entries-in-table-javascript/qaq-p/12461222</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
  &lt;P&gt;How can I count rows in table in SFP using JavaScript code? I am using xfa.resolveNodes function as I've seen somewhere else, but it only returns value "1", even if the table has much more rows.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1948748-2021-06-25-154616png.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1948749-2021-06-25-154633.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;I know that I can do this by counting rows in interface, but I wanted to do this using JavaScript directly on form's layout. Did I choose wrong event or something? Or maybe I am using wrong path in resolveNodes?&lt;/P&gt;
  &lt;P&gt;I'd be grateful for all help.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 13:52:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adobeforms-count-entries-in-table-javascript/qaq-p/12461222</guid>
      <dc:creator>former_member246634</dc:creator>
      <dc:date>2021-06-25T13:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: AdobeForms - count entries in table (JavaScript)</title>
      <link>https://community.sap.com/t5/technology-q-a/adobeforms-count-entries-in-table-javascript/qaa-p/12461223#M4667540</link>
      <description>&lt;P&gt;Hi Barlomiej,&lt;/P&gt;&lt;P&gt;I have simulated your requirement. Below is the interface, as you can see I have a table "IT_MARA" whose count will be displayed on the adobe form.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1949830-capture.png" /&gt;&lt;/P&gt;&lt;P&gt;Below is the code to find out the count and assign the count to the "&lt;STRONG&gt;TextField1"&lt;/STRONG&gt;. The code is written using java script in "Initialization" Event of the text box in AdobeForm&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; xfa.resolveNode("TextField1").rawValue = xfa.resolveNodes("$record.IT_MARA.DATA[*]").length;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1949832-capture-2.png" /&gt;&lt;/P&gt;&lt;P&gt;Below is the output. I am passing 30 lines to the table IT_MARA.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1949834-capture-3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;STRONG&gt;lternate Approach:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;As you have already added the field "GV_ITEM_COUNT" to the interface, you can also count the line of the table and assign to GV_ITEM_COUNT in interface itself using ABAP instead of doing it with JavScript.&lt;/P&gt;&lt;P&gt;Hope this answers your questions.&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Gourab&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 17:00:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adobeforms-count-entries-in-table-javascript/qaa-p/12461223#M4667540</guid>
      <dc:creator>Gourab_Dey</dc:creator>
      <dc:date>2021-06-25T17:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: AdobeForms - count entries in table (JavaScript)</title>
      <link>https://community.sap.com/t5/technology-q-a/adobeforms-count-entries-in-table-javascript/qaa-p/12461224#M4667541</link>
      <description>&lt;P&gt;First of all change layouts.ready -&amp;gt; Events with script.&lt;/P&gt;&lt;P&gt;Write down the below code.-&lt;/P&gt;&lt;P&gt;xfa.resolveNode("GV_ITEM_COUNT").rawValue = xfa.resolveNodes("$record.IT_PO_ITMEMS.DATA[*]").length&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jun 2021 07:57:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adobeforms-count-entries-in-table-javascript/qaa-p/12461224#M4667541</guid>
      <dc:creator>former_member753791</dc:creator>
      <dc:date>2021-06-27T07:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: AdobeForms - count entries in table (JavaScript)</title>
      <link>https://community.sap.com/t5/technology-q-a/adobeforms-count-entries-in-table-javascript/qaa-p/12461225#M4667542</link>
      <description>&lt;P&gt;Thank you for your answer. I have made a mistake in my code, it looked like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;this.rawValue = xfa.resolveNodes("$record.IT_PO_ITEMS[*]").length;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And it should look like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;this.rawValue = xfa.resolveNodes("$record.IT_PO_ITEMS&lt;STRONG&gt;.DATA&lt;/STRONG&gt;[*]").length;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I completely forgot that I am trying to get size of &lt;STRONG&gt;DATA&lt;/STRONG&gt; inside IT_PO_ITEMS, not the IT_PO_ITEMS itself... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Anyway, thank you again for your help!&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jun 2021 17:43:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adobeforms-count-entries-in-table-javascript/qaa-p/12461225#M4667542</guid>
      <dc:creator>former_member246634</dc:creator>
      <dc:date>2021-06-27T17:43:08Z</dc:date>
    </item>
  </channel>
</rss>

