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
#19278 - 01/27/06 03:55 AM advance datapage on value change
marvin Offline
Junior Member

Registered: 09/01/04
Posts: 10
Loc: Istanbul
Hello,

I have a csv-like data format which can be shown like this:

1;abc
1;acb
1;aaa
1;cde
1;def
2;ghi
2;fgh
..

First field indicates the datapage group, for example each line starts with 1 belongs to the same datapage. The number of lines in each datapage is also various. So what I would like to do is advance the data page only if first field's value changes.

In addition, i have 3 pages in the form, but second and third pages should only be ejected if there are enough lines of data on the datapage.

I could split the data if i had the Watch module, but i can only use the designer.

Thanks in advance,

Top
#19279 - 01/27/06 11:26 AM Re: advance datapage on value change
Anonymous
Unregistered


Here is some code that you could use in a user defined emulation that would split the data page every time the number at the start (the number before you hit the first wink .


Code:
if((&Idx <> mid(&str,1,pos(';',&str))) and (&Idx <> ''))
  doform()
  clearpage()
endif

set(&current.line,&current.line + 1)
store(&current.line,&str)

if(ge(&current.line,&current.lpp))
  doform()
  clearpage()
endif()

&Idx := mid(&str,1,pos(';',&str))
You will need to create a global string variable called idx for this to work.

What we are basically doing is testing the value of idx against the numbers at the start of the line. If they are different we create a new data page. If they are the same, we just store the line.

As for having 3 pages, if the objects are not of variable height then you can just map each one. For example, the data mappings on the first page would be from lines 1-50, the mappings on page 2 from 51-100 and 101-150 on page 3.

You could then create conditions to test if the lines are empty to make sure you don't print out blank pages when your data does not require more then 1 document page.

You could do an advanced condition that would look something like this

Code:
=length(trim(@(51,1,100))) <> 0 
So if line 51 contains no data, we don't print it.

Top
#19280 - 01/30/06 02:07 AM Re: advance datapage on value change
marvin Offline
Junior Member

Registered: 09/01/04
Posts: 10
Loc: Istanbul
This is exactly what i needed. Thanks!

Top


Moderator:  cosimo, OL Newsgroup Support