We need a global variable to change the value of it to use it as a flag to detect a the conditional break in java script.

While printing the table details we can detect the values of the current page and as well the previous page.

We will compare the field value of the present page with the previous page dynamically(while printing the output) and then we can change the global variable (flag) to detect the change in value.

 

Step 1 :  Click on ‘EDIT’ of adobe form layout as shown in the picture



Step 2: Click on form properties and the below popup will be displayed.



Step 3: Click on variables and the below screen will be displayed.



Step 4: Click on ‘+’ and add your variable and set a initial value as 1. I have taken brea here.

Step 5: Take a variable field in master page and open script editor of it. Please follow the below pseudo code to write the code. Write your code in ‘Ready Layout’ event in java script:

               A.          var thispage = xfa.layout.page(this);

                             var fields = xfa.layout.pageContent(thispage-2, “field”);

               this will give the previous page values of the current page and put the required field value to  another variable ‘lv1’.

              

               B.         var fields1 = xfa.layout.pageContent(thispage-1, “field”);

              

               this will give the field value of the current page and put the required field value to another variable ‘lv2’.

                   

               C.  Write the below code to change the flag value:

                   

                         if ( lv1 == lv2 )    // this will change the flag value as ‘1’ if page break is not found

                              {

                                       var r = brea.value ;   

                                            r = 1 ;

                                       brea.value = String(r) ; // Here you can do your calculations

                               }

                         if ( lv1 != lv2)   // this will change the flag value as ‘0’ if page break is found

                              {

                                  var zero = 0;

                                  brea.value = String(zero) ;

                              }

        this.rawValue = brea.value ;  // this will display the flag value in the screen



  • As the table field in the form, one page consists same value in the case of conditional page break. At the changing point of that particular table field value the flag will be 0.
  • You can use it to display subtotals, changing icons based on item category, display or hide according to the main table field value etc.
  • Else condition was not working while writing this java script code. Please like if it is helpful and mention improvement comments on it.

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !