mprakash
20th July 2004, 10:48
My requirement:

Want all the customised items sorted as per the item code excluding the project part in the report (Baa5c)
i.e, item should be sorted from 10th position of the item code

below Solution tried but doesn't work so need help:

defined a report input variable itempart and used in the report script to take only item part as shown below
say,

after.whinr140.item.1:
before.layout:
itempart = whinr140.item(10;15)

Sorted the report input variable itempart as ascending with proper sort order.

Still output is not sorting the way I want

Question:
Sort order(sort mode and sort seq) defined in the report input varible session will take into consideration if the value of the same variable is changed in the report script? and sort the records according to the new value? (which it got in the report script)

If this is not the option how can I achieve my requirement? note that we dont have the source

günther
20th July 2004, 13:37
Have a look at my thread:

http://www.baanboard.com/baanboard/showthread.php?t=9090&highlight=advanced

to get the basics.

Try the following way:
* add a report input variable "itempart" (don't worry about the fact, that that input variable won't be set by the session script).
* sort on that variable -- This is essential, that bic_gen generates the r.write.seq.file() calls that we use.
* in the report script, add code similiar to my thread, except that you initialized your variable *before* ORIGINALFUNCTION() -- and you can remove the other stuff.

So it should look like:

|**
|* Report Script
|**

declaration:

|**
|* rename the function that will be generated by bic_repgen
|**
#define ORIGINAL.FUNCTION() originally.generated.r.write.seq.file()
#define r.write.seq.file() ORIGINAL.FUNCTION()

functions:

#undef r.write.seq.file()

function extern r.write.seq.file()
{
|**
|* initialize your sorting variable here, e.g.
|**
itempart = whinr140.item(10;15)

|**
|* call the original function
|**
ORIGINAL.FUNCTION()
}

mprakash
20th July 2004, 16:03
Thanks a lot Gunthar!!!!. It worked perfectly! great

I achieved my results 50%. To achieve it fully I have something left over

In Baan5, item code includes prefixed project code with it. So in any print session I cannot give a range for only the item part, and get the report for the only specific item (specif item which is there in all the projects)

for example say A and Z are the projects, A1 and Z1 are the customised items

If I select the item range in the print session as 1 to Z1, report prints all the items within this range including A1 and Z1.

How can I get the report output which containes only A1 and Z1 items?? (including 1, A1, B1, C1,.....,Z1)

Without the sourcecode is it possible to achieve?

Thanks again

günther
21st July 2004, 07:03
Hmh, I see. I assume you have a standard session with input fields like cprj.f / cprj.t and item.f / item.t. That session delivers too much data for your requirement. So you could try to filter out the data that you don't want to see on the report itself (well, its not the best performance but anyway).

Since I only have IVc4, the following might work but is untested:

|**
|* Report Script
|**

declaration:

|**
|* rename the function that will be generated by bic_repgen
|**
#define ORIGINAL.FUNCTION() originally.generated.r.write.seq.file()
#define r.write.seq.file() ORIGINAL.FUNCTION()

functions:

#undef r.write.seq.file()

function extern r.write.seq.file()
{
domain tccprj cprj.part
domain tcitem item.part

|**
|* initialize your variables here
|**
cprj.part = ...
item.part = ...

if item.part >= item.f and item.part <= item.t then
|**
|* call the original function
|**
ORIGINAL.FUNCTION()
else
|**
|* simply do nothing; no spooling
|**
endif
}