Customization - Set Field in One Table Equal to Field in Another

If Rob's .NET approach is not something that will work for you, I would recommend the following Pre-process BPM Method Directive:

Method: (find the one you want to catch via "Trace Logging")
Condition(s): Set whatever works for you
Action(s): "execute 4GL code"
Script:
For Each ttTableName where (ttTableName.RowMod = 'A' or ttTableName.RowMod = 'U') no-lock.
Find Table2Name where Table2Name.Company = ttTableName.Company and TableName.KeyField = ttTableName.KeyField no-lock.

If not available Table2Name then return.

If available Table2Name then do:

assign ttTableName.TargetField = Table2Name.TargetField.

End.

End.

Replace "TableName", "Table2Name", "KeyField" and "TargetField" with your specific parameters

Note that, depending on what ttTableName you are working with you may not have a RowMod field and, therefore, would not want to include that condition in your script (script will not run if the condition for RowMod is in and the ttTableName has no RowMod field).

Feel free to contact me directly if any further clarification would be helpful.

Thanks,

Nathan Bonner
Total Plastics, Inc.
616.717.1613
bonner.n@...

--- In vantage@yahoogroups.com, "Rob Bucek" <rbucek@...> wrote:
>
> I am doing that similar thing in a few places. Is the data youre after
> available in one of the views provided within the form youre working in?
> If its not there you could do a foreign key view then something like
>
> Dim edvDtl As EpiDataView = CType(oTrans.EpiDataViews("OrderDtl"),
> EpiDataView)
>
> Dim vOrder As String = edvDtl.dataView(edvDtl.Row)("OrderNum")
>
> Dim edvRel As EpiDataView = CType(oTrans.EpiDataViews("OrderRel"),
> EpiDataView)
>
> edvRel.dataView(edvRel.Row)("ShortChar01") = vOrder
>
>
>
> this assumes you have two views available, one named OrderDtl, and one
> named OrderRel. You could also connect through an adaptor....Im still
> learning the best way to go about things, I can usually accomplish what
> Im attempting to do but it might make more experienced folk shake their
> heads....
>
>
>
>
>
>
>
>
>
> Rob Bucek
>
> Manufacturing Engineer
>
> PH: 715-284-5376 ext 311
>
> FAX: 715-284-4084
>
> <http://www.dsmfg.com/>
>
> (Click the logo to view our site)
>
>
>
> ________________________________
>
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> Of b35crile
> Sent: Tuesday, March 24, 2009 6:38 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Customization - Set Field in One Table Equal to Field
> in Another
>
>
>
> I have several customizations I am working on in Vantage 8.03.404B where
> I need to set a field in one table (current screen)equal to a field in
> another table (related screen). I am then using this field (current
> screen) as a Condition in a BPM (Update)to control the desired action. I
> see this as my solution as the BPM does not appear to recognize a field
> from the other table (related screen) in a Condition. Does someone have
> an example of this script? Or does anyone have another solution? In one
> of these customizations, I am trying to get data from the OrderDtl table
> to OrderRel table.
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
I have several customizations I am working on in Vantage 8.03.404B where I need to set a field in one table (current screen)equal to a field in another table (related screen). I am then using this field (current screen) as a Condition in a BPM (Update)to control the desired action. I see this as my solution as the BPM does not appear to recognize a field from the other table (related screen) in a Condition. Does someone have an example of this script? Or does anyone have another solution? In one of these customizations, I am trying to get data from the OrderDtl table to OrderRel table.
I am doing that similar thing in a few places. Is the data youre after
available in one of the views provided within the form youre working in?
If its not there you could do a foreign key view then something like

Dim edvDtl As EpiDataView = CType(oTrans.EpiDataViews("OrderDtl"),
EpiDataView)

Dim vOrder As String = edvDtl.dataView(edvDtl.Row)("OrderNum")

Dim edvRel As EpiDataView = CType(oTrans.EpiDataViews("OrderRel"),
EpiDataView)

edvRel.dataView(edvRel.Row)("ShortChar01") = vOrder



this assumes you have two views available, one named OrderDtl, and one
named OrderRel. You could also connect through an adaptor....Im still
learning the best way to go about things, I can usually accomplish what
Im attempting to do but it might make more experienced folk shake their
heads....









Rob Bucek

Manufacturing Engineer

PH: 715-284-5376 ext 311

FAX: 715-284-4084

<http://www.dsmfg.com/>

(Click the logo to view our site)



________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of b35crile
Sent: Tuesday, March 24, 2009 6:38 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Customization - Set Field in One Table Equal to Field
in Another



I have several customizations I am working on in Vantage 8.03.404B where
I need to set a field in one table (current screen)equal to a field in
another table (related screen). I am then using this field (current
screen) as a Condition in a BPM (Update)to control the desired action. I
see this as my solution as the BPM does not appear to recognize a field
from the other table (related screen) in a Condition. Does someone have
an example of this script? Or does anyone have another solution? In one
of these customizations, I am trying to get data from the OrderDtl table
to OrderRel table.





[Non-text portions of this message have been removed]
I agree with Nathan, as I am starting to learn more about BPM's (and ive
written several such as the one Nathan outlined) im actually finding
that I can do a bit more with them, and often with less headaches.
Though you wont find that they'll always replace the need for a .net
customization.



Rob Bucek

Manufacturing Engineer

PH: 715-284-5376 ext 311

FAX: 715-284-4084

<http://www.dsmfg.com/>

(Click the logo to view our site)



________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of bonner.nathan
Sent: Tuesday, March 24, 2009 1:08 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Customization - Set Field in One Table Equal to
Field in Another



--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"b35crile" <b35crile@...> wrote:
>
> I have several customizations I am working on in Vantage 8.03.404B
where I need to set a field in one table (current screen)equal to a
field in another table (related screen). I am then using this field
(current screen) as a Condition in a BPM (Update)to control the desired
action. I see this as my solution as the BPM does not appear to
recognize a field from the other table (related screen) in a Condition.
Does someone have an example of this script? Or does anyone have another
solution? In one of these customizations, I am trying to get data from
the OrderDtl table to OrderRel table.
>

If the .NET script example submitted by Rob isn't to your liking or you
find the standard data views limiting within the customization
framework, I would use a PreProcess BPM on the Method associated with
the transaction you are trying to catch (tracing will help you find the
correct method if you don't already know it). Set whatever conditions
you want for your BPM and then use an "exicute 4GL code" action with the
following script:

For Each ttTableName where (ttTableName.RowMod = 'A' or
ttTableName.RowMod = 'U') no-lock.
Find Table2Name where Table2Name.Company = ttTable.Company and
Table2Name.KeyField = ttTableName.KeyField no-lock.

If not available Table2Name then return.

If available Table2Name then do:

assign ttTableName.TargetField = Table2name.TargetField.

End.

End.

Feel free to call me should aditional clarification be needed.

Nathan Bonner
616-717-1613





[Non-text portions of this message have been removed]