IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#37299 - 09/22/11 05:25 PM Expression Layout assistance
Chris S. Offline
OL Newbie

Registered: 09/22/11
Posts: 16
I am trying to be able to run a couple different files from one database and having a little trouble working it out without doing silly workarounds. Basically what I have is a loan coupon book, printing say 10-15 records of the same name, then switching to a new name, printing 10-15 more, and so on and so forth. I then have a second layout to print envelopes for these sets, so I need one envelope for book 1, one for book 2, etc. I have tried the "CHANGED" expression, but it expressly states that it treats as false the first record, so while I can print the rest of the envelopes ok, I couldn't do the first one.

I have tried this as a layout expression, but with no luck:
IF(RECORD_NR()=1,Print,(IF(CHANGED([Account Number]),Print,Skip)))

Basically I want to say:
If record number is 1, print
else if account number changed, print
else skip

Any thoughts or help? Thanks!


--edit--
As a side note, yes I know I could add an extra record at the beginning, but that's not the proper way to work it out, imho

--edit--


Edited by Chris S. (09/22/11 05:28 PM)

Top
#37303 - 09/23/11 07:45 AM Re: Expression Layout assistance [Re: Chris S.]
Sander vd Berg Offline
OL Expert

Registered: 06/10/08
Posts: 207
Loc: Objectif Lune NL
Your expression looks fine to me, but I tried it and it seems PSM behaves a bit odd when you use CHANGED in the "if true" or "if false" branch of an IF. I have no idea why..

Try creating two separate expressions instead. First define the following layout condition:

Code:
IF (RECORD_NR() = 1, Print, IF (@Changed@, Print, Skip))

PSM should automatically create a new variable called "Changed". For this variable, use the following expression:

Code:
CHANGED([Account Number])

Top
#37369 - 09/28/11 06:32 PM Re: Expression Layout assistance [Re: Sander vd Berg]
Chris S. Offline
OL Newbie

Registered: 09/22/11
Posts: 16
I actually fiddled some more and turned things around and got this to work:
Code:
IF(CHANGED([Account Number]),Print,IF(RECORD_NR()=1,Print,Skip))


Doesn't make sense to me why this works and my original doesn't, but it is simple and doesn't require any additional variables to be introduced. Hopefully someone else might find it useful as well.

Top