<?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: Add leading zero to value using script in Adobe form in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811721#M4811037</link>
    <description>&lt;P&gt;Thanks for the reply, value of 'pagen' is 1 ( it always provides the current page number).&lt;/P&gt;&lt;P&gt;in debugging mode i see error " accessor: pagen.length is unknown".&lt;/P&gt;&lt;P&gt;look like  length function work for string only , please let me know how do i find the length/no. of digits of number?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;NK&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2023 03:37:26 GMT</pubDate>
    <dc:creator>uirji_netweaver</dc:creator>
    <dc:date>2023-08-31T03:37:26Z</dc:date>
    <item>
      <title>Add leading zero to value using script in Adobe form</title>
      <link>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaq-p/12811717</link>
      <description>&lt;P&gt;My requirement is print the barcode with page number and other field values , the page number length should be 2 digits ( ex: 00,01,02..etc) , i added the below logic for page number , i see page number is printing without leading zero , so i added the below code to concatenate the leading zero , but its not working , please review the code and let me know for the correction.&lt;/P&gt;
  &lt;P&gt;var pagen = xfa.layout.page(Ref($));&lt;/P&gt;
  &lt;P&gt;var flen = string(pagen).length;&lt;/P&gt;
  &lt;P&gt;if (flen=1)&lt;/P&gt;
  &lt;P&gt;{ &lt;/P&gt;
  &lt;P&gt;this.rawValue = concat("0", pagen , "01" , counter)&lt;/P&gt;
  &lt;P&gt;else&lt;/P&gt;
  &lt;P&gt;this.rawValue = concat(pagen , "01" , counter)&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 03:02:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaq-p/12811717</guid>
      <dc:creator>uirji_netweaver</dc:creator>
      <dc:date>2023-08-30T03:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Add leading zero to value using script in Adobe form</title>
      <link>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811718#M4811034</link>
      <description>&lt;P&gt;Did you debug it, what happens?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 08:02:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811718#M4811034</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-08-30T08:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add leading zero to value using script in Adobe form</title>
      <link>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811719#M4811035</link>
      <description>&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;Thanks for the reply , in debugging i see length is never filled, i tried below code also. i dont see any syntax error but the length field (flen) is never filled , so what right syntax to calaclate no of digits of number ?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;var pagen = xfa.layout.page(Ref($));&lt;BR /&gt;var flen = pagen.length;&lt;BR /&gt;if (flen &amp;lt; 2)then&lt;BR /&gt;this.rawValue = concat("0", pagen , "01" , counter)&lt;BR /&gt;else&lt;BR /&gt;this.rawValue = concat(pagen , "01" , counter)&lt;BR /&gt;endif&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2023 16:13:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811719#M4811035</guid>
      <dc:creator>uirji_netweaver</dc:creator>
      <dc:date>2023-08-30T16:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add leading zero to value using script in Adobe form</title>
      <link>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811720#M4811036</link>
      <description>&lt;P&gt;"length" would work if page is of type string. What is value and type of pagen by debugger?&lt;/P&gt;&lt;P&gt;"concat" is a method of the String object, you can't use like that. Concatenation is "usually always" done using + in javascript.&lt;/P&gt;&lt;P&gt;Are you really sure that you debug step by step till the end? What happens?&lt;/P&gt;&lt;P&gt;You'd better look at javascript documentation and forums.&lt;/P&gt;&lt;P&gt;Javascript is not a SAP language. See wikipedia.&lt;/P&gt;&lt;P&gt;Please provide all information we need to understand.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 17:21:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811720#M4811036</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-08-30T17:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Add leading zero to value using script in Adobe form</title>
      <link>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811721#M4811037</link>
      <description>&lt;P&gt;Thanks for the reply, value of 'pagen' is 1 ( it always provides the current page number).&lt;/P&gt;&lt;P&gt;in debugging mode i see error " accessor: pagen.length is unknown".&lt;/P&gt;&lt;P&gt;look like  length function work for string only , please let me know how do i find the length/no. of digits of number?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;NK&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 03:37:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811721#M4811037</guid>
      <dc:creator>uirji_netweaver</dc:creator>
      <dc:date>2023-08-31T03:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add leading zero to value using script in Adobe form</title>
      <link>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811722#M4811038</link>
      <description>&lt;P&gt;KISS pseudo code:&lt;/P&gt;&lt;P&gt;if i &amp;lt; 10 then length = 1&lt;/P&gt;&lt;P&gt;else if i &amp;lt; 100 then length = 2&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;or search javascript forums how to convert number to string, you can imagine how much frequent is the question (or just read the javascript reference documentation).&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 05:17:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/add-leading-zero-to-value-using-script-in-adobe-form/qaa-p/12811722#M4811038</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-08-31T05:17:23Z</dc:date>
    </item>
  </channel>
</rss>

