BaanTech
14th August 2002, 20:10
I'm trying to create a session that will combine tt (session, company) authorizations with the DEM details to list what
sessions users can actually see via their desktops. Standard session tgbrg4450m000 does not provide the details I
need.

My problem is that there can be nested processes where in
the DEM menu the session is found only after opening up
several sub-menus (processes).

eg. Role: FGL102 (General Ledger II), Activity (Process): FGLB01 (Transaction Processing), Activity (Process): FGLB03 (Maintain), session tfgld1101m000.

General Ledger II -> Transaction Processing -> Maintain -> tfgld1101m000.

The error is 'Query should be in Exec Status or Eval Status'.

The same scenario is applicable to utilities, however I have
gotten around this through the use of arrays as there was no
standard index that met my needs.

I could get around this problem by creating new functions
(with unique names) to allow to go down multiple levels,
however I do not know the maximum depth at this point.

Is there any way to make a function name dynamic ?

Code is as follows:

function select.where.used.as.nested.business.process() |#XCH002v5
{
select tgbrg520.*
from tgbrg520
where tgbrg520._index2 = {:tgbrg520.proc}
order by tgbrg520._index2
selectdo
select.business.model.by.business.process()
select.where.used.as.nested.business.process()
selectempty
| break
endselect
}

Thanks.

BaanTech

lbencic
14th August 2002, 20:58
That's called recursion - not allowed in Baan.
There are some methods of getting around it, but pretty complicated. I'm not even sure if I have some old example, but this has come up before. Do you have source? Look at the explode BOM to see some example of how Baan does it. I'll try and dig out a sample.

mark_h
14th August 2002, 20:59
I am attaching a script. I take no claim for this script and did not want to attach it, but in the spirit of sharing I figured I had nothing to lose. Maybe if you improve(any of the routines) it in some way you might let me know. I did not develop this session, but tweaked it a little in a couple of places. I am not sure if this answers you questions about making it dynamic, but this is how we run through the roles. So maybe this will give you something to build on, then please share with us. Send me a PM sometime and we can take this discussion offline.

USE OF any of this script is at your own risk. :)

Mark

BaanTech
14th August 2002, 21:22
Thanks mark_h.

For the time being I've just copied the same function over
another 9 times and named each new one <function name>.#
and ensured each function calls the next number.

(This should be sufficient as I think the most sub-menu levels I've
I ever see in Baan is around 6 or 7 ?)

For now I can live with my code redundancy. Performance
is not affected since the nesting logic only continues when the
tgbrg520 (nested) value is found for the new process.

I'll take a look at the script and see how the trees were handled
as soon as time permits.