Baanboard.com

Go Back   Baanboard.com > Forum > Baan SIGs > Code & Utilities

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 11th July 2006, 17:12
dorleta's Avatar
dorleta dorleta is offline
Senior Member
 
Join Date: Dec 2001
Location: Madrid - Spain
Posts: 133
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 :
Code:
choice.print.data:
on.choice:
	if open.report(1,"",1) then
		read.mcs010.leq()
		paginar()
		close.reports()
	else
		choice.again()
	endif
and the function ( one include maybe a smart solution)
Code:
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.name, file.tmp.str
	long file, file.tmp, ret , car
	string	record(RECORD.LENGHT)

|	carro = ff$()


|	mipag = lattr.pageno
	mipag = 0

	seq.close(g.lfn)

	file.name  = g.tmp.file

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


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

	file = seq.open( file.name, "r")
	file.tmp = seq.open(file.tmp.str, "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)
 		endif

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

	seq.close(file)
	seq.close(file.tmp)
	ret = file.cp(file.tmp.str, file.name)

}

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

Dorleta,

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!

Günther
Reply With Quote
  #3  
Old 13th July 2006, 14:50
günther günther is offline
Guru
 
Join Date: Jan 2002
Location: Ehingen, Germany
Posts: 570
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?

Günther
Reply With Quote
Sponsored Links
  #4  
Old 30th September 2006, 13:53
raikar_raviraj raikar_raviraj is offline
Senior Member
 
Join Date: Sep 2006
Location: Mumbai, India
Posts: 112
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

hi,

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

Regards

Raviraj
Reply With Quote
Reply


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 7 26th November 2009 20:49
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 09:35.


©2001-2017 - Baanboard.com - Baanforums.com