Pablo79
14th October 2009, 14:31
Dear all, is there a function or a predefined variable that return the current form code?

Thank you in advance,
Pablo

kbartelds
14th October 2009, 15:07
Hello Pablo,

I think form.curr wil do the trick.

Regards,
Klaas

Pablo79
14th October 2009, 15:28
Hi Klaas, the form.curr returns the current form number in the session (i.e. 1, 2, etc.). I need something that returns "tiitm0101m0001", "tiitm0101m0002", etc.). For example for the session code there is prog.name$ that returns "tiitm0101m000".

Thanks,
Pablo

kbartelds
14th October 2009, 16:58
you can use progname$ to get the session and with that find the form in ttadv tables, using form.curr.

Regards,
Klaas

Pablo79
16th October 2009, 16:17
Thanks for you reply. I have made it like you suggested me.

Here my code

domain tcmcs.str16 l.form.str.code

domain tcmcs.str2 l.session.package
domain tcmcs.str3 l.session.module
domain tcmcs.str8 l.session.code

domain tcmcs.str3 l.form.module
domain tcmcs.str9 l.form.code

domain tcmcs.str4 l.version
domain tcmcs.str2 l.release
domain tcmcs.str4 l.customer

domain tcmcs.str8 l.curr.pacc
domain tcmcs.long l.form.curr

l.form.code = ""

l.curr.pacc = curr.pacc$
l.form.curr = form.curr

l.session.package = prog.name$(1;2)
l.session.module = prog.name$(3;3)
l.session.code = prog.name$(6;8)

select ttaad121.vers:l.version,
ttaad121.rele:l.release,
ttaad121.cust:l.customer
from ttaad121
where ttaad121._index1 = {:l.curr.pacc, :l.session.package}
and ttaad121._compnr = 000
endselect

while isspace(l.form.str.code)

select ttadv211.fmod:l.form.module,
ttadv211.cfrm:l.form.code
from ttadv211
where ttadv211._index1 = { :l.session.package,
:l.session.module,
:l.session.code,
:l.version,
:l.release,
:l.customer
}
and ttadv211._compnr = 000
as set with :l.form.curr rows
selectdo
l.form.str.code = l.session.package & l.form.module & l.form.code
endselect

if isspace(l.form.str.code) then
if not get.father.VRC.ok(l.session.package, l.version, l.release, l.customer, l.version, l.release, l.customer) then
return("")
endif
endif
endwhile

return(l.form.str.code)

}

function domain tcbool get.father.VRC.ok( domain tcmcs.str2 i.package,
domain tcmcs.str4 i.version,
domain tcmcs.str2 i.release,
domain tcmcs.str4 i.customer,
ref domain tcmcs.str4 r.father.version,
ref domain tcmcs.str2 r.father.release,
ref domain tcmcs.str4 r.father.customer)
{
r.father.version = ""
r.father.release = ""
r.father.customer = ""

select ttadv111.vedf:r.father.version,
ttadv111.redf:r.father.release,
ttadv111.cudf:r.father.customer
from ttadv111
where ttadv111._index1 = {:i.package, :i.version, :i.release, :i.customer}
and ttadv111._compnr = 000
endselect

if isspace(r.father.version)
and isspace(r.father.release)
and isspace(r.father.customer)
then
return(false)
endif
return(true)
}

Thank you again,
Pablo

NPRao
16th October 2009, 23:05
You can query from the tools table ttadv211.