1. Clara Sánchez Casado
  2. PowerBuilder
  3. Thursday, 8 June 2023 08:16 AM UTC

Hi,

Is there a way to dynamically change the property "New Page on Group Break" of a datawindow group by code using dot notation or modify?

Thanks in advance.

 

 

 

Attachments (1)
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Tuesday, 13 June 2023 10:08 AM UTC
  2. PowerBuilder
  3. # 1

The syntax in the DW is:

group(level=1 header.height=0 trailer.height=0 by=("subject" ) newpage=yes header.color="536870912"

You could get the DW syntax and modify the newpage=yes/no then regenerate the DW.

This then leads me to another way. Have two copies of the DW one with and one without and just dynamically change the dataobject.

Hope this helps.

 

David

Comment
  1. Mark Goldsmith
  2. Tuesday, 13 June 2023 13:52 PM UTC
Hi David...a "newpage=no" is never generated by the painter and so one just needs to be careful when trying to change the setting by regenerating the DW...but this is a great suggestion nonetheless. By default, it will either have "newpage=yes" or nothing at all, depending on whether the checkbox is checked at design time. It will still accept "newpage=no" (no errors will be generated) if this was inserted prior to regeneration and will turn the newpage setting off.

So, the point being that if the datawindow object is initially created with the setting off and then one attempts to change it to on dynamically by looking for the position of "newpage=no" it won't find it...you'll have to insert the entire "newpage=yes" in the correct position.
  1. Helpful 2
  1. David Peace (Powersoft)
  2. Tuesday, 13 June 2023 14:20 PM UTC
Good point, so design with it on first :)
  1. Helpful 1
  1. Mark Goldsmith
  2. Tuesday, 13 June 2023 23:44 PM UTC
Agreed ;)
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Thursday, 8 June 2023 13:16 PM UTC
  2. PowerBuilder
  3. # 2

the trick is to turn this on and setup the group to page break on to be a field/compute that you control with a value.  so at runtime you change the value to change whether it breaks

Comment
  1. Clara Sánchez Casado
  2. Friday, 9 June 2023 06:34 AM UTC
Thanks, I will try that.
  1. Helpful
  1. David Peace (Powersoft)
  2. Tuesday, 13 June 2023 09:57 AM UTC
Might be tricky if you are still wanting the group break, just no page break. But this does seem a reasonable solution.
  1. Helpful
  1. mike S
  2. Tuesday, 13 June 2023 13:26 PM UTC
just have 2 groups setup to handle it. we use a generic object that runs any report and is setup at runtime, and it includes option to change compute fields, so that is why i use this technique to allow the user to decide at runtime whether to have the page break or not. It is incredibly useful.



if i used a window for that specific report, i would probably just change the group by syntax at runtime.



In any case, it is a shame that it isn't changeable directly via modify. it really seems like a stupidly easy thing to do.
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Thursday, 8 June 2023 08:30 AM UTC
  2. PowerBuilder
  3. # 3

There seems no way to access this property.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.