Getting instance to current part/job/etc object

Adam asks:
> When writing custom code, is it possible to get an instance to the
> current object loaded without having to reload it again? For instance,
> if I want to set a property on the part, I can GetById("partnum") and
> set it, but if one is already loaded, can I just reference the
> partform, JobEntryForm, etc, and a ref to the object from there.

Absolutely.

> If it is available, what is the syntax?

In your transaction object, there's a collection of data-views that hold all
of the data for the current form. If you look up the EpiDataView in help,
you'll see an example.

CType(oTrans.EpiDataViews("JobHead"),

Dim edvJobHead As EpiDataView = CType(oTrans.EpiDataViews("JobHead"),
EpiDataView)

' You can then access a field with this syntax:

edvJobHead.dataView(JobHead.Row)("FieldName")

HTH,

Mark W.
When writing custom code, is it possible to get an instance to the
current object loaded without having to reload it again? For instance,
if I want to set a property on the part, I can GetById("partnum") and
set it, but if one is already loaded, can I just reference the
partform, JobEntryForm, etc, and a ref to the object from there. If it
is available, what is the synatax?
thanks!
The forms access and update data through dataviews. Do a search in
Vantage help for 'EpiDataView' and it is explained somewhat.

But anyway:

<oneline>
Dim edvPartView As EpiDataView = CType(oTrans.EpiDataViews("PartView"),
EpiDataView)
</oneline>

edvPartView.dataView(edvPartView.Row)("FieldName") = somevalue

<oneline>
edvPartView.Notify( New EpiNotifyArgs([PartForm], edvPartView.Row,
edvPartView.Column))
</oneline>

good luck,

Bernie.


--- In vantage@yahoogroups.com, "adamtuliper" <amt@...> wrote:
>
> When writing custom code, is it possible to get an instance to the
> current object loaded without having to reload it again? For
instance,
> if I want to set a property on the part, I can GetById("partnum") and
> set it, but if one is already loaded, can I just reference the
> partform, JobEntryForm, etc, and a ref to the object from there. If
it
> is available, what is the synatax?
> thanks!
>