Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
37%
Installation Wizard into new VRC
39%
Manual into existing VRC
3%
Manual into new VRC
21%
Total votes: 38

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 3rd November 2017, 17:52
dromeo dromeo is offline
Junior Member
 
Join Date: Feb 2016
Posts: 11
dromeo is on a distinguished road
Baan: BAAN IV - DB: ORACLE - OS: WINDOWS 7
Smile Compare same values and put a flag based on condition (report)
Baan: ERP LN 6.1 FP10 (Infor ERP 10.4)
C/S: None/Unknown

Hello,

I'm trying to compare Items on a report script, on a before.field, to retrieve the same items, and then if they are equal and have a negative planned qty and positive planned qty (so, planned requirement and planned receipt) on the same Item put a flag, that can be a string (Yes).

I'm having doubts on which could be the best an practical way to achieve this. If by using a for --> ex.

Code:
for i = 1 to n??  
       if whinp100.item = item AND whinp100.kotr = tckotr.requirement AND 
       whinp100.kotr = tckotr.receipt then
		test = "Yes"
       else
		test = "No"
       endif
endfor
or with a Do-While, but I don't know if with Baan Language I could use this type of condition.

To take into account that the items are sorted ascending, so the same Items appear in a block.

Thank you for any advice or help!!
Reply With Quote
  #2  
Old 6th November 2017, 14:28
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,934
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Is this a report script or a session script? In a report script it will read each record from a file - so you have to track somethings yourself. To see what happens in a report script just put one in debug mode and step thru it watching it print..
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #3  
Old 6th November 2017, 16:27
dromeo dromeo is offline
Junior Member
 
Join Date: Feb 2016
Posts: 11
dromeo is on a distinguished road
Baan: BAAN IV - DB: ORACLE - OS: WINDOWS 7
Quote:
Originally Posted by mark_h View Post
Is this a report script or a session script? In a report script it will read each record from a file - so you have to track somethings yourself. To see what happens in a report script just put one in debug mode and step thru it watching it print..
Hello Mark!

Thank you very much for your reply! Very appreciated as always!

It's a report script! I didn't really understood when you say --> "so you have to track somethings yourself !??!"

I will follow your advice anyway to see what's happen in debug mode, although it can be a little complicated because the extraction output of the report it's a little bit large to track 1 by 1. Maybe 200 records.

Thank you

Daniel Romeo
Reply With Quote
  #4  
Old 6th November 2017, 18:15
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,934
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
If this is in a report script then the records will be read one at a time - and for example probably printed in the detail layout. So as the first record gets printed in the layout you would need to track the item number and information you want. A better option might be to just read the input file yourself and add information to the file. I have to find the thread that shows that. So let me look for that thread for you to look at.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
Sponsored Links
  #5  
Old 6th November 2017, 18:21
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,934
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Here are a couple of threads http://www.baanboard.com/baanboard/s...?threadid=9090 and http://www.baanboard.com/baanboard/s...&threadid=1908 - both offer options to working in the report script itself and the type of things you could do. Neither are options for the feint of heart. It takes some work.

For something like this I would rather work in the session script, but that is not always an option.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #6  
Old 6th November 2017, 23:40
dromeo dromeo is offline
Junior Member
 
Join Date: Feb 2016
Posts: 11
dromeo is on a distinguished road
Baan: BAAN IV - DB: ORACLE - OS: WINDOWS 7
Quote:
Originally Posted by mark_h View Post
Here are a couple of threads http://www.baanboard.com/baanboard/s...?threadid=9090 and http://www.baanboard.com/baanboard/s...&threadid=1908 - both offer options to working in the report script itself and the type of things you could do. Neither are options for the feint of heart. It takes some work.

For something like this I would rather work in the session script, but that is not always an option.
Hello Mark!

Thanks for the reply!

I think that you're right! Using the .tmp file seems like a better idea instead. So having the data already in the output and do the reading of the file with all the items already there.

But I do have some doubts regarding the script that you wrote on the thread you linked to me --> http://www.baanboard.com/baanboard/s...&threadid=1908

Code:
after.receive.data:
	if(first=0) then
		r.o = seq.open (r.datafile$ & ".tmp","w")
		r.reccount = 0
		while e = 0
			select tipgc001.cplb
			from tipgc001
			where tipgc001._index1 = {:tisfc001.ccot.a,
                      :tisfc001.mitm}
			selectdo
			endselect
			l = seq.puts(concat$("",
				tipgc001.cplb,
				tisfc001.pdno,
				tisfc001.ccot.a,
				tisfc001.mitm,
				error.message,r.reccount),r.o)
			r.reccount = r.reccount + 1
			r.read.seq.file()
		endwhile
		l = seq.flush (r.o)
		l = seq.close (r.lfn)
		l = seq.close (r.o)
		l = run.baan.prog( "sort","-t +0n
 -1 +1n -2 " & r.datafile$ & ".tmp -o " & 
r.datafile$ & ".tmp", RP_WAIT)
		r.lfn = seq.open (r.datafile$ & ".tmp" ,"a+")
		r.read.seq.file()
		first = 1
	endif

after.program:
	l = seq.unlink(r.datafile$ & ".tmp")
Could I use: after.report instead??? which will be the difference???

I don't understand some of the functions, and if they are usable with Infor 10.4. ???

Code:
l = seq.flush (r.o)
--> honestly I don't know what this function does. I can guess by the name "flush" but still....

Code:
l = run.baan.prog( "sort","-t +0n
 -1 +1n -2 " & r.datafile$ & ".tmp -o " &
r.datafile$ & ".tmp", RP_WAIT)
--> I could use this code as it is?

Code:
l = seq.unlink(r.datafile$ & ".tmp")
??

Do you have maybe a tutorial link to understand the meaning of these functions? So I can study them and then apply them. This is the first time that I have to do a file manipulation of a .tmp

You are right, working directly from the session script would be better, but this is a session that I can't customize.

Thank you very much!!!

Daniel Romeo
Reply With Quote
  #7  
Old 7th November 2017, 17:00
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,934
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
In my case I do not have source code and we wanted another field on the report that was not selected in the session script. On top of that they wanted this new field to be a sort field. So what I am doing is adding a field into the report data using the report script. The seq.flush just causes any buffered data to be written to that file. The run.baan.prog is actually doing the sort on the data in the file to get it in the correct order before it starts reading and printing the data. So it basically opens a file with .tmp and writes the new records into that file. Then it sorts the .tmp file back into the original file name baan uses (r.datafile$). The seq.unlink just deletes the .tmp file.

I cannot guarantee this will work on your version of baan - plus we run on UNIX and it looks like you are on windows for an os. So not really sure how that works - the two threads are two different hacks that basically do the same thing. I think the thread by günther is actually a little cleaner. I have only ever used this on one session.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
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 On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +2. The time now is 08:23.


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