Go Back > Forum > Baan SIGs > Code & Utilities

User login

Frontpage Sponsor


Google search

For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
Installation Wizard into new VRC
Manual into existing VRC
Manual into new VRC
Total votes: 49

Baanboard at LinkedIn

Reference Content

Thread Tools Display Modes
Old 11th July 2006, 17:12
dorleta's Avatar
dorleta dorleta is offline
Senior Member
Join Date: Dec 2001
Location: Madrid - Spain
Posts: 134
dorleta is on a distinguished road
Baan: BaanIV - DB: All - OS: All
page x of y, another solution.

When baan is running a report, the report is saved in a tmp file, this tmp file is sent to the device when the report is closed.

This solution is based in the modification of this tmp file before is sent to the device. In a first step I count the times that the "tag" "Página" (Spanish version" ) appear. (It is posible avoid this step exporting the total pages from the report script) and after rewrite this tmp file adding the total pages.

It´s a primitive solution but works fine.

In the program script :
	if,"",1) then
and the function ( one include maybe a smart solution)
function	paginar()

	table	tttaad320
	#define RECORD.LENGHT	2000
	long fichero
|	string carro(10)
	#define 	NEW.PAGE.ID  "Página"

	long mipag
	domain	tcmcs.str100, file.tmp.str
	long file, file.tmp, ret , car
	string	record(RECORD.LENGHT)

|	carro = ff$()

|	mipag = lattr.pageno
	mipag = 0

	seq.close(g.lfn)  = g.tmp.file

        	| ** contar el número de páginas tb podría obtenerse exportando desde listado
	file =, "r")
	seq.gets( record, RECORD.LENGHT, file)
	while not seq.eof(file)
		car = rpos( record, NEW.PAGE.ID )
		if  car then
			mipag = mipag + 1
		seq.gets( record, RECORD.LENGHT, file)
		| **

	file.tmp.str = creat.tmp.file$(bse.tmp.dir$() )

	file =, "r")
	file.tmp =, "w")

	seq.gets( record, RECORD.LENGHT, file)

	while not seq.eof(file)
		car = rpos( record, "Página")
		if  car then
			record = record & cf$(1) & " de  " & str$(mipag) & cf$(0)

		seq.puts( record, file.tmp)
		record = ""
		seq.gets( record, RECORD.LENGHT, file)
	seq.puts( record, file.tmp)

	ret = file.cp(file.tmp.str,


Last edited by mark_h : 11th July 2006 at 17:43.
Reply With Quote
Old 13th July 2006, 14:04
günther günther is offline
Join Date: Jan 2002
Location: Ehingen, Germany
Posts: 574
günther is on a distinguished road
Baan: IVc4 - DB: Informix - OS: HP-UX


you've done a great job! I just got it to work on my system and it looks good.

I had to do the following changes:
1. Changed your #define NEW.PAGE.ID into german (...)
2. Changed the spanish string inside the second while-seq.gets-loop into the #define
3. added a seq.unlink(file.tmp.str) at the end of the function to remove the 2nd temp file

And while using the debugger and output to "DL" and "D", I deteced that directly to seq.close(g.lfn) the output got display with ttstpdisplay. So:
4. changed seq.close(g.lfn) into seq.flush(g.lfn)

What remains open:
* The added "of y" ("de y") is always on the right side of the line containing "page ...".
* The Label is hard-coded via a #define. That might become a problem within sessions that switch the language e.g. based on the customer's language.

But that is all for now. Thanks a lot!

Reply With Quote
Sponsored Links
Old 13th July 2006, 14:50
günther günther is offline
Join Date: Jan 2002
Location: Ehingen, Germany
Posts: 574
günther is on a distinguished road
Baan: IVc4 - DB: Informix - OS: HP-UX
Found a problem

And here comes my problem: When I set one of the report input fields to Ascending or Descending, the report uses a second temp file for sorting. In that case g.lfn seems to behave different and page x of y does not work.

Any ideas?

Reply With Quote
Old 30th September 2006, 13:53
raikar_raviraj raikar_raviraj is offline
Senior Member
Join Date: Sep 2006
Location: Mumbai, India
Posts: 114
raikar_raviraj is on a distinguished road
Baan: IV c4, ERP Ln 6.1 - DB: SQL Server, Informix - OS: Windows 2003, Unix
Exclamation problem after compiling


I had compiled the code which you had sent.. it gave some errors.. but actually when i ran the report.. it didnt show up any data.

i used the function as it is i.e panigar

The warnings that it gives are
return value of function seq.close ignored
return value of function seq.ret ignored

can u please help me solve this query


Reply With Quote
Old 20th February 2018, 12:05
pralash pralash is offline
Senior Member
Join Date: Feb 2017
Posts: 220
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Can you please explain, which one is added to the header layout instead of special variable "page" for getting the page number as Page 1 of 5.... etc
Thanks in advance,
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Page x of y: Jo Büche's solution. ~Vamsi Code & Utilities 11 21st February 2018 07:26
Page x of y: Kevin Brock's solution. ~Vamsi Code & Utilities 4 5th January 2006 11:08
Baan Performance Tracing Questions thomas_b Performance & Tuning 5 25th July 2005 11:22
solution not associated with a service pack ?? learner Tools Administration & Installation 2 7th January 2005 02:18
Herstellkostenberechnung in BaaN 4c Kai's Forum Users Deutsches Forum 4 5th July 1999 00:00

All times are GMT +2. The time now is 01:30.

©2001-2018 - -