1. Daniel Vivier
  2. PowerBuilder
  3. Tuesday, 14 July 2020 14:23 PM UTC

We have some reports in an application that were designed for landscape mode. However, we realized that in some circumstances (program options) they can be changed to portrait mode, which we think most people prefer.

So we added a bunch of DW expressions for objects' X positions, widths, etc., based on a retrieval argument for portrait Y/N.

Unfortunately when we ran that, passing in the argument for portrait mode, we got an entirely blank page after every page of the report. It's not that any objects were actually extending onto that page - we checked carefully.

Rather, what I eventually figured out is that PB determines how wide a report needs to be based on the initial values for those X positions etc. (the ones that appear before the tab and the expression in Edit Source), not on the calculated expression values. If that implies the report is wider than 8" (I guess), you get extra blank pages. So what we had to do to make the problem go away was change all of those initial values to the ones that fit in portrait mode. 

I also tried to trick PB (to avoid all of that detailed editing of the initial values) by hacking the expressions for those X values etc. at runtime, before the retrieve. So for instance if an X value was "2000~tif (PORTRAIT = ~"Y~", 1500, 2000)" I wrote code that would analyze that and resave it as "1500~tif (PORTRAIT = ~"Y~", 1500, 2000)". For whatever reason, that didn't work to avoid the blank pages - the change had to be made in the original saved DW code, not at runtime.

Interesting (and quite frustrating until I got it all figured out)!

Sivaprakash BKR Accepted Answer Pending Moderation
  1. Wednesday, 15 July 2020 08:05 AM UTC
  2. PowerBuilder
  3. # 1

Good info.  Useful at times. Thanks.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 15 July 2020 07:46 AM UTC
  2. PowerBuilder
  3. # 2

Interesting indeed, thanks for the info.

Maybe it'll be easier to just create two different datawindows? One in portrait and another in landscape format?

regards.

Comment
  1. Daniel Vivier
  2. Wednesday, 15 July 2020 11:46 AM UTC
Thanks, Miguel. I did consider that, but we like to keep our executables small. Also, these are really complicated DWs (financial reports in an accounting program) so I'd rather not have two very similar ones that we'd have to maintain if anything changes.
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 15 July 2020 12:05 PM UTC
Maybe an option could be to maintain only one (portrait) and create a little tool which applies the transformations you would need for a landscape version using Modify instead of expressions in x, y. Then from code do an export or describe of datawindow.syntax and save that somehow to a library?

regards
  1. Helpful
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.