Expand my Community achievements bar.

SOLVED

Conditional Page Break after Subform

Avatar

Level 2

I have two subforms. i  have show and hide subform accoriding to some condition.

Layout should be based on condition as below. lets assume x is a condition

1.  x is true then show the subform1 and subform2 should show start from second page.

2. x is false then hide the subform1 and subform2 should show on first page.

 

so requirement is  if x is true then i need compulsory page break after subform1.

 

Please suggest.

 

Thanks in advance

 

1 Accepted Solution

Avatar

Correct answer by
Level 10

Ok, given you subforms are childs of a body page or subform named "Page", you can add this JavaScript into the contidional break dialog of subform2.

 

// If this subform is not the first visible under "Page", create a page break.
Page.resolveNodes('#subform.[$.presence eq "visible"]').item(0).name !== this.name

radzmar_0-1586357252257.png

 

Hope this helps!

View solution in original post

7 Replies

Avatar

Correct answer by
Level 10

Ok, given you subforms are childs of a body page or subform named "Page", you can add this JavaScript into the contidional break dialog of subform2.

 

// If this subform is not the first visible under "Page", create a page break.
Page.resolveNodes('#subform.[$.presence eq "visible"]').item(0).name !== this.name

radzmar_0-1586357252257.png

 

Hope this helps!

Avatar

Level 2

I am unable to get this I have below scenario 

 

abc.PNGabc1.PNG

 

 

under condition ----   Page.resolveNodes('#subform.[$.presence eq "visible"]').item(0).name !== this.name

 

Am I doing something wrong please help me.

Thanks in advance

Avatar

Level 2

I have tried with below also but unable to get page break before second subform "content2"

 

abc.PNGabc1.PNG

Avatar

Level 10

Change the scriping language to JavaScript.

radzmar_0-1589194985119.png

Avatar

Level 1
Hi Punit, can you please share more details . i am having the same requirement but it's not woking after adding script as mentioned. For ex. i am having x and y internal table .if y internal table is having data then i need to print y internal table on new page . if x internal table is not having any data then y internal table data will be print on first page. can you please share the solution with screen shot. Thanks in advance.