timb25
24th May 2002, 17:09
Is there a way to use a variable that will show the current vrc on the Form, Report other than hardcoding it in the layout?

evesely
24th May 2002, 17:28
You can select the data from ttaad121 (Packages in Package Combination) using the curr.pacc$ (current package combination) and the current package as indices. You can then put the three fields you desire on the form.

NPRao
24th May 2002, 18:33
Hi Ed,

the solution you mentioned gets the Package-VRC of a particular package combination, which is not the right result if you have multiple package VRC authorizations.

So, if we like to get the current P-VRC of a user -

you can write a function, which based on the user returns the current PVRC -


function long get.cpvrc(
ref domain ttadv.cpac cpac,
ref domain ttadv.vers vers,
ref domain ttadv.rele rele,
ref domain ttadv.cust cust )
{
long flag
select ttadv040.*
from ttadv040
where ttadv040.user = :logname$
order by ttadv040._index1
as set with 1 rows
selectdo
flag = 1
|* Current package vrc found
selectempty
flag = 0
|* Current package vrc not found, maybe its a new login
|* and a pvrc has to be assigned yet.
endselect
return(flag)
}

evesely
24th May 2002, 23:53
My impression was that he wanted to display the VRC on a form or a report when a session was run. In that case, we really don't care about the current PVRC, since this might not have any correlation to the package combination in which the session is run. I could have misinterpreted it though.

I guess the route to choose depends on exactly what timb is trying to accomplish:D .

Now that I think about it, my solution would only tell you the highest level VRC for that package combination. You might need to walk through the VRC hierarchy to find the one that actually contains the form (or report) object being used. Perhaps you could utilize the 'explode' functionality as well.

Fun, fun, fun...

~Vamsi
25th May 2002, 00:35
Well we will have to wait for timb to reply back. I am inclined to go with Ed on this one. Usually ttadv040 has records only for users who are developing code.

Ed, an alternative to using explode is the bunch of functions in the dll ttdllvrcsearch. This has the advantage of returning any component and not just the executable object :).

timb25
28th May 2002, 18:39
Here is a scenerio. We have customized reports and on each report we have a variable called prog.name$ on all report headings. This variable shows the report code of the current report that is run.

Likewise, I want a variable that will do the same sort of thing showing the current vrc of the object used. Right now we use two vrc customizations.. tst0 and obg0. For any report or form, I want to know which one is being used. And, in theory, by inserting a variable on the form or report, I will see which customization is currently running.

NPRao
28th May 2002, 19:59
Tim,

I dont think there is any predefined variables for doing that.

You might need to do some coding, and you can use this function -


vrc_search_repobj
long vrc_search_repobj( domain ttaad.clan clan, domain ttadv.cpac cpac,
domain ttadv.cmod cmod, domain ttadv.crep crep, long tdep,
ref domain ttadv.vers tver() fixed, ref domain ttadv.rele trel() fixed,
ref domain ttadv.cust tcus() fixed )


Pre: -
Post: if return <> 0 then current record of ttadv336 has been set.
Ret: < 0 found report object is expired
0 report object not found
> 0 report object found, position of newest object within VRC-tree
is returned
Desc: Search for the newest report object belonging to the given report,
based on the specified VRC-tree.
In: clan, cpac, cmod, crep identifies the report to search for
tdep contains the depth of the vrc search tree
tver, trel, tcus contains the vrc search tree
Usually, the VRC-tree can be obtained from the ttadv111 record and
depends on the package of the component and
whether this information is needed during runtime or development time


Use #pragma used dll ottdllvrcsearch

Good Luck... :)

gentercz
29th May 2002, 15:40
@NPRao,

when i try to invoke the function you decribed i get the error message "illegal number of subscripts" for variables tver, trel, tcus.

how do i define them ???

Thanks for your help,
jochen

NPRao
29th May 2002, 20:06
Hi JoChen,

those 3 arguments are 2-dimensional arrays.

you have to get the package VRC and the vrc structure by using a select statement on table ttadv111.

As mentioned in the DLL usage -

Desc: Search for the newest report object belonging to the given report, based on the specified VRC-tree.
In: clan, cpac, cmod, crep identifies the report to search for tdep contains the depth of the vrc search tree tver, trel, tcus contains the vrc search tree Usually, the VRC-tree can be obtained from the ttadv111 record and depends on the package of the component and whether this information is needed during runtime or development time


if vrc_search_repobj( ttadv330.clan, ttadv330.cpac, ttadv330.cmod, ttadv330.crep,
ttadv111.tdep, ttadv111.tver, ttadv111.trel, ttadv111.tcus ) < 1 then
.....
|* missing report object
endif