camste
5th April 2012, 11:48
Hi everybody,
I'm having a problem with a report I'm making. There are two sessions calling this same report, but based on different items. Because of this I wanted some of the linked data to be fetched in the report instead of in the session scripts to avoid copying and pasting the code (or making a function for this small logic).

In one of my sessions I then have this (the other one is based on the rows in warehouse receipts though, so the fetching is done with a different query, but it still gives the item):

function read.main.table()
{
select tcibd001.*
from tcibd001
where tcibd001._index1 inrange {:item.f}
and {:item.t}
order by tcibd001._index1
selectdo
rprt_send()
endselect
}

Simple enough right?

In the report script:
declaration:
table ttcibd003
table ttdisa001
table ttcmcs001
table ttcibd001

extern domain cddev.str16 item.short

before.program:
item.short = "test"

Detail.1:
before.layout:
if isspace(tcibd001.item) then
item.short = "No!"
else
select tcibd003.*, tdisa001.*, tcmcs001.*
from tcibd003, tdisa001, tcmcs001
where tcibd003._index1 = {:tcibd001.item,tdisa001.cuqs}
and tdisa001._index1 = {:tcibd001.item}
and tcibd003.unit refers to tcmcs001
selectdo
item.short="Found"
selectempty
tcibd003.conv = 1
endselect
item.short = "Yes!" | tcibd001.item(10;16)
endif
I've just been trying to debug using this item.short variable, but it seems like it doesn't call my report script at all! Item.short always appears as empty in the report results, even though the item has been fetched. The description is shown. I've tried compiling the report script in debug mode, but it never enters into debug.

Report layout fields:
item.short, tcibd001.dsca, tdisa001.cwar, tdisa001.cuqs, tcibd003.conv and tcibd001.cuni

Input fields:
item.short, num.labels, tcibd001.item, tcibd001.dsca, tdisqa001.cwar, tdisa001.cuqs, tcibd003.conv and tcibd001.cuni
The report shows values for the two fields from tcibd001, but not for the other ones which should be computed.

Why isn't it called?? I've tried looking at other scripts in Baan, but it all seems similar, and it doesn't look like like there's anything missing.

bdittmar
5th April 2012, 17:35
function read.main.table()
{
select tcibd001.*
from tcibd001
where tcibd001._index1 inrange {:item.f}
and {:item.t}
order by tcibd001._index1
selectdo
rprt_send()
endselect
}

Simple enough right?

In the report script:
declaration:
table ttcibd003
table ttdisa001
table ttcmcs001
table ttcibd001

extern domain cddev.str16 item.short

before.program:
item.short = "test"

Detail.1:
before.layout:
|put tcibd001.item in detail.1

if isspace(tcibd001.item) then
item.short = "No!"
else
select tcibd003.*, tdisa001.*, tcmcs001.*
from tcibd003, tdisa001, tcmcs001
where tcibd003._index1 = {:tcibd001.item,tdisa001.cuqs}
and tdisa001._index1 = {:tcibd001.item}
and tcibd003.unit refers to tcmcs001
selectdo
item.short="Found"
selectempty
tcibd003.conv = 1
endselect
item.short = "Yes!" | tcibd001.item(10;16)
endif

lattr.print = false

detail.2:
before.layout:

|put the expected fields in layout 2 !

Regards

Hitesh Shah
6th April 2012, 19:35
Hi everybody,
Why isn't it called?? I've tried looking at other scripts in Baan, but it all seems similar, and it doesn't look like like there's anything missing.

Probably because layout details.1 does not exist or it has print condition always returning false.

steveauckly
6th April 2012, 23:32
If it never enters debug mode, then you probably have an instance of the report running and it will not load the debug version. Check your processes.

ulrich.fuchs
7th April 2012, 11:19
If the report doesn't enter debug mode, then that's the problem you need to solve. Obviously your code and what's in the compiled object is not the same. Try to become more sure about that: Put a before.report layout it, and type some text in that layout ("blabla" will do). Compile, execute. Does it print? If not, one reason could be that you have the report again in a higher package VRC that hides your object. Can you find it in the "Reports" Session? No? Go and check on the file system ($BSE/application), that's what counts in the end, might be, that something is hanging around there, that is not in the data dictionary any longer,

camste
7th April 2012, 15:42
My office mate was able to debug it in the end. He was logged in as bsp. I have no idea if that was the reason he could debug it. I don't believe this report was running anywhere else before since I was developing it by myself. And it didn't exist in any other vrc than the one I was developing in. But there he found that the query didn't return any values. Changing the query made the report show the right values. (But I think it's strange that it didn't show these test values in the item.short variable at least, since they didn't depend on the data.) Afterwards I saw that I needed to log out and in again to see the new values though. I don't know if there might be some caching going on somewhere. I had tried logging in over again several times while I was developing though, so I have no idea what happened. It works now at least. But thank you everybody.