cancel
Showing results for 
Search instead for 
Did you mean: 

Control break on smartforms

gastn_jareo
Active Participant
0 Kudos

I'm learning the use of smartforms. I'm listing an internal table with a TABLE node, sorting by USER field and with the option "Event on Sort Begin" marked.

Then I'm putting a title for every change of user before the lines of this user. It works well.

Now I want a little variant. If there are a lot of lines for a single user it may be difficult to found it, so I want to print de user title at top of main window of every page that is not the first one. Then the user title is going to be printed for every user change and for every page change too, remembering you wich user have the lines of the user block comming from the previous page.

For that I've created a new LINE under HEDER node with same format and information of USER title, and with "Only at Page Break" option marked. It seems to works well, but...

And here is the problem / question:

When a control break is made on middle of a user group lines it works well, but when las line of a particular user is printed exactly as last line of MAIN window next page shows the USER title twice. Once by the "Evente on Sort Begin" and the other from HEADER.

Any Idea on how can I fix it?

Thanks a lot!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

i understood u r problem,.. even the for the last line also. it is printing the header agin in the next page.

Try this..just <b>tick the PAGE PROTECTION</b> for the "event on Sort Begin".

Please Close this thread.. when u r problem is solved

Reward if Helpful

Regards

Naresh Reddy K

gastn_jareo
Active Participant
0 Kudos

No, it isn't work. I think page protection is to force a page break when a block will not fits on rest of main window. But is not the case.

Thanks!

Former Member
0 Kudos

yes u r correct but,

why iam sugged is it is printing at the last line of the page so.. may be the system is triggering the next page at same time thats why the header is printing agin.

do u want to print a new page every time when the user cheged...

gastn_jareo
Active Participant
0 Kudos

No, I don't. I think if I wanted a page break for every user change it should be easier, but I'm not trying it.

Anyway... I've tried your proposal and it doesn't work.

Thanks anyway!

Former Member
0 Kudos

hi,

any way thank you for the implementation.

two headers means as of now i thought previous one and present one. but now i realised the that the same new user name is <b>printin again one is for user change and another time is NEWPAGE</b>...

some how u need to avoid this... either new user one or the new pageone... is my understanding is correct at this time..??

gastn_jareo
Active Participant
0 Kudos

Yes, new user title is printed twice: One from control break and another from page break.

Both lines are identical, so you can avoid any of them. You can avoid the easy one.

Former Member
0 Kudos

HI

1.maintain a flag vairable.. v_flag... for the new page printing give a condion v_flage = ' ' means space.

in the at new field inset the program lines and chage the value of v_flag = 'X'.

now newpage one will not trigger... but we need to avoid this every time it shoud work only if the case now u r facing.. it means every time v_flag shoud be space... and in this case it should be X.

2. to achive this.. while prining the item details insert the program lines there chage the value of the v_flag to space..

if the new user comes in between then the v_flag will be set space then in the next iteration it come to SPACE. but if it going to be in u r case as explined above

before goingto the next iteration.. it triggers the new page one but it faile because v_flag is X.

<b>i am sure it work. read it carefully aging if u r not getting</b>.

Please Close this thread.. when u r problem is solved

Reward if Helpful

Regards

Naresh Reddy K

gastn_jareo
Active Participant
0 Kudos

I don't understand exactly what you sugest, but I understand the idea. I was thinking on something like that but it wasn't working very well. But now I fixed it and it works.

My solution was:

- Declare a global variable: SHOW_USER type c value 'X'

- Under HEADER node I've put a line for user title with following condition: SHOW_USER = 'X'.

- Under Event on Sort Begin node I've put a code node with: SHOW_USER = 'X'.

(Note: with right-click on LINE node you can't create a code node, but you can do it from Edit - Node - Create)

- Under Event on Sort End node I've put a code node (From Edit - Node - Create) with following code: CLEAR SHOW_USER.

So SHOW_USER is a boolean that determinate if the user title on header should be printed or not. Every time a group of users begins it's set to TRUE, because if there are a page break the user should be reprinted. Every time a group of users ends it's set to FALSE, because you don't know if the page is ending so if there are a page break just there the next page will show only the automatig user title and not the user title of the header. If there aren't a page break just there, there aren't any problem because next line will be a new user title for next user, and the flag will be set to TRUE again.

So it works perfectly, exactly as I wanted!

Naresh, finally you didn't gave me the exact solution, but may be yes and I didn't understood it. Anyway, you tried to help me and you helped me to think on it and in other possibilities, so as the problem is solved I think you deserve your 10 points yet.

Thanks!

Answers (0)