BPM .NET Actions

Peter,

we're having a problem here trying to install the BPMServer.  can we get in touch with you directly via e-mail to ask some questions?

thanks,

mickey
Has anyone used a custom action process using .NET code? I am not familiar with Progress and am looking to bypass any custom action process code and use .NET instead of learning Progress programming code. For any anyone not familiar with what I'm talking about, I'm referring to the 'Invoke .NET method' option for BPM actions. I have setup my BPMServer and everything communicates properly, but I'm not sure how I can code my .NET custom logic for setting some values in the 'tt' tables prior to an 'Update'.


I am trying to replicate this Progress 4GL code in .NET:

find first ttUD100 where ttUD100.RowMod='A' no-error.
assign ttUD100.Date01 = NOW.
assign ttUD100.Number01 = 1600.

.NET Version in my custom Action logic:

public virtual void OnBeforeUpdate(System.Data.DataTable ttUD100, System.Data.DataTable ttUD100Attch, System.Data.DataTable ttUD100A)
{
//
// TODO: Replace the throw statement with any code for an action before UD100.GetaNewUD100() method invocation
//

Trace.WriteLine("PeteTest .NET Action Process START...");
DataRow row = ttUD100.Rows[0];
if (row["RowMod"].ToString() == "A")
{
row["Date01"] = DateTime.Now;
row["Number01"] = 1600;
Trace.WriteLine("RowValue:2 " + row["Key1"].ToString() + ", " + row["Date01"] + " " + row["Number01"] + ": DateTime.Now=" + DateTime.Now);
}//end if
Trace.WriteLine("PeteTest .NET Action Process END...");

}

I'm getting an error saying 'Date02 is null' when I try to set any of the row values,even if I'm actually setting Date02 field. If I comment out the lines where I'm trying to set the datafields and just output the values in the Trace Log everything works. It's just when I try change the value of a row field is where the error is generated. I would expect that I can use similar logic as the 4GL code and just assign the temporary table 'tt' fields, but I could be wrong.

Does anyone have any sample of code of how to set datafields values in .NET that they are willing to share?
Just curious: If you already have a 4GL BPM working, why go to (much less reliable & incurring a much more significant client app speed hit) client .net?

Rob




________________________________
From: petecon77 <pconstan@...>
To: vantage@yahoogroups.com
Sent: Friday, July 10, 2009 8:46:34 AM
Subject: [Vantage] BPM .NET Actions





Has anyone used a custom action process using .NET code? I am not familiar with Progress and am looking to bypass any custom action process code and use .NET instead of learning Progress programming code. For any anyone not familiar with what I'm talking about, I'm referring to the 'Invoke .NET method' option for BPM actions. I have setup my BPMServer and everything communicates properly, but I'm not sure how I can code my .NET custom logic for setting some values in the 'tt' tables prior to an 'Update'.

I am trying to replicate this Progress 4GL code in .NET:

find first ttUD100 where ttUD100.RowMod= 'A' no-error.
assign ttUD100.Date01 = NOW.
assign ttUD100.Number01 = 1600.

.NET Version in my custom Action logic:

public virtual void OnBeforeUpdate( System.Data. DataTable ttUD100, System.Data. DataTable ttUD100Attch, System.Data. DataTable ttUD100A)
{
//
// TODO: Replace the throw statement with any code for an action before UD100.GetaNewUD100( ) method invocation
//

Trace.WriteLine( "PeteTest .NET Action Process START...");
DataRow row = ttUD100.Rows[ 0];
if (row["RowMod" ].ToString( ) == "A")
{
row["Date01" ] = DateTime.Now;
row["Number01" ] = 1600;
Trace.WriteLine( "RowValue: 2 " + row["Key1"]. ToString( ) + ", " + row["Date01" ] + " " + row["Number01" ] + ": DateTime.Now= " + DateTime.Now) ;
}//end if
Trace.WriteLine( "PeteTest .NET Action Process END...");

}

I'm getting an error saying 'Date02 is null' when I try to set any of the row values,even if I'm actually setting Date02 field. If I comment out the lines where I'm trying to set the datafields and just output the values in the Trace Log everything works. It's just when I try change the value of a row field is where the error is generated. I would expect that I can use similar logic as the 4GL code and just assign the temporary table 'tt' fields, but I could be wrong.

Does anyone have any sample of code of how to set datafields values in .NET that they are willing to share?







[Non-text portions of this message have been removed]
Well, we do use a lot of Microsoft products and .NET here and I was looking to not have to learn Progress syntax if possible. I do understand it may a performance hit, but I figure I'd try out something as a test to prove that, but this is where I got stuck.

We have a lot of customizations to do and I figure if I can do things in .NET the better for me and my team.

I am really reaching out to anyone who has used .NET actions and if so, what were they used for and how did they implement it? I may be trying to do something that's not practical, but Support hotline will not help me with this, and there's not much documentation on this.

-Peter Constantinidis
Global Packaging, Inc.

--- In vantage@yahoogroups.com, Robert Brown <robertb_versa@...> wrote:
>
> Just curious: If you already have a 4GL BPM working, why go to (much less reliable & incurring a much more significant client app speed hit) client .net?
>
> Rob
>
>
>
>
> ________________________________
> From: petecon77 <pconstan@...>
> To: vantage@yahoogroups.com
> Sent: Friday, July 10, 2009 8:46:34 AM
> Subject: [Vantage] BPM .NET Actions
>
>
>
>
>
> Has anyone used a custom action process using .NET code? I am not familiar with Progress and am looking to bypass any custom action process code and use .NET instead of learning Progress programming code. For any anyone not familiar with what I'm talking about, I'm referring to the 'Invoke .NET method' option for BPM actions. I have setup my BPMServer and everything communicates properly, but I'm not sure how I can code my .NET custom logic for setting some values in the 'tt' tables prior to an 'Update'.
>
> I am trying to replicate this Progress 4GL code in .NET:
>
> find first ttUD100 where ttUD100.RowMod= 'A' no-error.
> assign ttUD100.Date01 = NOW.
> assign ttUD100.Number01 = 1600.
>
> .NET Version in my custom Action logic:
>
> public virtual void OnBeforeUpdate( System.Data. DataTable ttUD100, System.Data. DataTable ttUD100Attch, System.Data. DataTable ttUD100A)
> {
> //
> // TODO: Replace the throw statement with any code for an action before UD100.GetaNewUD100( ) method invocation
> //
>
> Trace.WriteLine( "PeteTest .NET Action Process START...");
> DataRow row = ttUD100.Rows[ 0];
> if (row["RowMod" ].ToString( ) == "A")
> {
> row["Date01" ] = DateTime.Now;
> row["Number01" ] = 1600;
> Trace.WriteLine( "RowValue: 2 " + row["Key1"]. ToString( ) + ", " + row["Date01" ] + " " + row["Number01" ] + ": DateTime.Now= " + DateTime.Now) ;
> }//end if
> Trace.WriteLine( "PeteTest .NET Action Process END...");
>
> }
>
> I'm getting an error saying 'Date02 is null' when I try to set any of the row values,even if I'm actually setting Date02 field. If I comment out the lines where I'm trying to set the datafields and just output the values in the Trace Log everything works. It's just when I try change the value of a row field is where the error is generated. I would expect that I can use similar logic as the 4GL code and just assign the temporary table 'tt' fields, but I could be wrong.
>
> Does anyone have any sample of code of how to set datafields values in .NET that they are willing to share?
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
I have a fairly good background in Microsoft development products, though more VBA than full blown .NET. Once I crossed the first 4GL hurdle (actually creating a very simple program), the rest has been relatively easy. A little over a month ago, I knew almost nothing about 4GL. Now, I have some pretty cool stuff (if I do say so myself) written in 4GL.

If you have any programming smarts at all, and you do if you have been programming .NET apps, you will have no problem with 4GL. You should get the 4GL Programming Reference, which, IIRC, I downloaded for free from the Progress web site. Also, I have found the denizens of this exchange to be most helpful (thank you Nigel, Charlie, Rob, and probably a few others) whenever I needed clarity or redirection.

You really should try 4GL. For its purposes, it really is useful, and not that hard to learn.

Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY

"The World Leader in Back-lit Mirrors & Mirror TV Technology"

T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com>

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of petecon77
Sent: Friday, July 10, 2009 10:39 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: BPM .NET Actions





Well, we do use a lot of Microsoft products and .NET here and I was looking to not have to learn Progress syntax if possible. I do understand it may a performance hit, but I figure I'd try out something as a test to prove that, but this is where I got stuck.

We have a lot of customizations to do and I figure if I can do things in .NET the better for me and my team.

I am really reaching out to anyone who has used .NET actions and if so, what were they used for and how did they implement it? I may be trying to do something that's not practical, but Support hotline will not help me with this, and there's not much documentation on this.

-Peter Constantinidis
Global Packaging, Inc.

--- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>, Robert Brown <robertb_versa@...> wrote:
>
> Just curious: If you already have a 4GL BPM working, why go to (much less reliable & incurring a much more significant client app speed hit) client .net?
>
> Rob
>
>
>
>
> ________________________________
> From: petecon77 <pconstan@...>
> To: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>
> Sent: Friday, July 10, 2009 8:46:34 AM
> Subject: [Vantage] BPM .NET Actions
>
>
>
>
>
> Has anyone used a custom action process using .NET code? I am not familiar with Progress and am looking to bypass any custom action process code and use .NET instead of learning Progress programming code. For any anyone not familiar with what I'm talking about, I'm referring to the 'Invoke .NET method' option for BPM actions. I have setup my BPMServer and everything communicates properly, but I'm not sure how I can code my .NET custom logic for setting some values in the 'tt' tables prior to an 'Update'.
>
> I am trying to replicate this Progress 4GL code in .NET:
>
> find first ttUD100 where ttUD100.RowMod= 'A' no-error.
> assign ttUD100.Date01 = NOW.
> assign ttUD100.Number01 = 1600.
>
> .NET Version in my custom Action logic:
>
> public virtual void OnBeforeUpdate( System.Data. DataTable ttUD100, System.Data. DataTable ttUD100Attch, System.Data. DataTable ttUD100A)
> {
> //
> // TODO: Replace the throw statement with any code for an action before UD100.GetaNewUD100( ) method invocation
> //
>
> Trace.WriteLine( "PeteTest .NET Action Process START...");
> DataRow row = ttUD100.Rows[ 0];
> if (row["RowMod" ].ToString( ) == "A")
> {
> row["Date01" ] = DateTime.Now;
> row["Number01" ] = 1600;
> Trace.WriteLine( "RowValue: 2 " + row["Key1"]. ToString( ) + ", " + row["Date01" ] + " " + row["Number01" ] + ": DateTime.Now= " + DateTime.Now) ;
> }//end if
> Trace.WriteLine( "PeteTest .NET Action Process END...");
>
> }
>
> I'm getting an error saying 'Date02 is null' when I try to set any of the row values,even if I'm actually setting Date02 field. If I comment out the lines where I'm trying to set the datafields and just output the values in the Trace Log everything works. It's just when I try change the value of a row field is where the error is generated. I would expect that I can use similar logic as the 4GL code and just assign the temporary table 'tt' fields, but I could be wrong.
>
> Does anyone have any sample of code of how to set datafields values in .NET that they are willing to share?
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>



[Non-text portions of this message have been removed]
Thom wrote:
> If you have any programming smarts at all, and you do if you
> have been programming .NET apps, you will have no problem
> with 4GL. You should get the 4GL Programming Reference,
> which, IIRC, I downloaded for free from the Progress web
> site. Also, I have found the denizens of this exchange to be
> most helpful (thank you Nigel, Charlie, Rob, and probably a
> few others) whenever I needed clarity or redirection.

Also, more of the scope (program variables) appear to be available from 4GL.
In .Net, it passes a DataSet (in E9 anyway) and that's the only information
you have. If you want to look something up, you'll have to make an ADO.Net
call. I have found that the whole dataset may or may not be there as well.

The only disadvantage with 4GL is integrating (INSERT INTO...) with an SQL
database...

Mark W.
Yes, I ran into this exact situation. There is little documentation on this and support was not very knowledgeable regarding .NET custom actions.

It ends up that you simply need to default some of the fields that are passed in, if they have no value. This is what I am currently using to do this. (FixDBNulls is written in VB.NET, easily converted to C#).

I have added code to your routine that should work (though I didn't actually test it, so may be some errors) but you should get the idea. If you have any further questions, feel free to post or email me, with email being the best option because otherwise I may forget to reply as work is hectic.

public virtual void OnBeforeUpdate(System.Data.DataTable ttUD100, System.Data.DataTable ttUD100Attch, System.Data.DataTable ttUD100A)
{
//
// TODO: Replace the throw statement with any code for an action before UD100.GetaNewUD100() method invocation
//

Trace.WriteLine("PeteTest .NET Action Process START...");

DataRow row = ttUD100.Rows[0];

if (row["RowMod"].ToString() == "A")
{
row.BeginEdit();
FixDBNulls(row);
row["Date01"] = DateTime.Now;
row["Number01"] = 1600;
Trace.WriteLine("RowValue:2 " + row["Key1"].ToString() + ", " + row["Date01"] + " " + row["Number01"] + ": DateTime.Now=" + DateTime.Now);
row.EndEdit();
}//end if
Trace.WriteLine("PeteTest .NET Action Process END...");

}


Public Class FixDBNulls
Public Shared Sub FillDBNulls(ByVal row As DataRow)
For j As Integer = 0 To row.ItemArray.Length - 1
If row(j).Equals(DBNull.Value) Then
Select Case row.Table.Columns(j).DataType.ToString()
Case "System.Int32", "System.Int16", "System.Double"
row(j) = 0
Exit Select
Case "System.Boolean"
row(j) = False
Exit Select
Case "System.String"
row(j) = ""
Exit Select
Case "System.DateTime"
row(j) = DateTime.MinValue
Exit Select
End Select
End If
Next
End Sub

End Class

--- In vantage@yahoogroups.com, "petecon77" <pconstan@...> wrote:
>
> Has anyone used a custom action process using .NET code? I am not familiar with Progress and am looking to bypass any custom action process code and use .NET instead of learning Progress programming code. For any anyone not familiar with what I'm talking about, I'm referring to the 'Invoke .NET method' option for BPM actions. I have setup my BPMServer and everything communicates properly, but I'm not sure how I can code my .NET custom logic for setting some values in the 'tt' tables prior to an 'Update'.
>
>
> I am trying to replicate this Progress 4GL code in .NET:
>
> find first ttUD100 where ttUD100.RowMod='A' no-error.
> assign ttUD100.Date01 = NOW.
> assign ttUD100.Number01 = 1600.
>
> .NET Version in my custom Action logic:
>
> public virtual void OnBeforeUpdate(System.Data.DataTable ttUD100, System.Data.DataTable ttUD100Attch, System.Data.DataTable ttUD100A)
> {
> //
> // TODO: Replace the throw statement with any code for an action before UD100.GetaNewUD100() method invocation
> //
>
> Trace.WriteLine("PeteTest .NET Action Process START...");
> DataRow row = ttUD100.Rows[0];
> if (row["RowMod"].ToString() == "A")
> {
> row["Date01"] = DateTime.Now;
> row["Number01"] = 1600;
> Trace.WriteLine("RowValue:2 " + row["Key1"].ToString() + ", " + row["Date01"] + " " + row["Number01"] + ": DateTime.Now=" + DateTime.Now);
> }//end if
> Trace.WriteLine("PeteTest .NET Action Process END...");
>
> }
>
> I'm getting an error saying 'Date02 is null' when I try to set any of the row values,even if I'm actually setting Date02 field. If I comment out the lines where I'm trying to set the datafields and just output the values in the Trace Log everything works. It's just when I try change the value of a row field is where the error is generated. I would expect that I can use similar logic as the 4GL code and just assign the temporary table 'tt' fields, but I could be wrong.
>
> Does anyone have any sample of code of how to set datafields values in .NET that they are willing to share?
>
Hi,

I am trying to invoke a .net method but I am getting

pmThread|Worker|IController.Process() System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

Any ideas on this? I am running on a 64bit server but developing on 32bit, does make a difference as to where com objects are registered?

Original Code

Option Strict Off
Option Explicit On

Imports Bpm.Action
Imports System
Imports System.Net
Imports System.Data
Imports System.Diagnostics
Imports System.Net.Mail


Imports System.ComponentModel
Imports Microsoft.VisualBasic



Namespace Bpm.Custom

Public Class Customer

Public Overridable Sub OnAfterUpdate(ByVal ttCustomer As System.Data.DataTable, ByVal ttCustomerAttch As System.Data.DataTable, ByVal ttCustBillTo As System.Data.DataTable, ByVal ttCustChild As System.Data.DataTable, ByVal ttCustomerDocs As System.Data.DataTable, ByVal ttCustUPSEmail As System.Data.DataTable, ByVal ttGlbCustCred As System.Data.DataTable, ByVal ttShipTo As System.Data.DataTable, ByVal ttShipToAttch As System.Data.DataTable, ByVal ttShipToPriceLst As System.Data.DataTable, ByVal ttCustomerDocsSH As System.Data.DataTable, ByVal ttShipToUPSEml As System.Data.DataTable, ByVal ttCustomerPriceLst As System.Data.DataTable, ByVal ttCustMFBill As System.Data.DataTable, ByVal ttShipToMFBill As System.Data.DataTable)
'
'TODO: Replace the throw statement with any code for an action after Customer.Update() method invocation
'

Trace.WriteLine("PeteTest .NET Action Process START...")
Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("Odyssey")

Dim Mailmsg As New System.Net.Mail.MailMessage
Mailmsg.To.Clear()
Mailmsg.To.Add(New System.Net.Mail.MailAddress("brychan.williams@..."))
Mailmsg.From = New System.Net.Mail.MailAddress("brychan.williams@...")
Mailmsg.Subject = "(subject text)"
Try
Mailmsg.Body = "(message text here)"
obj.Send(Mailmsg)
Catch ex As Exception

End Try

End Sub
End Class
End Namespace

--- In vantage@yahoogroups.com, "petecon77" <pconstan@...> wrote:
>
> Has anyone used a custom action process using .NET code? I am not familiar with Progress and am looking to bypass any custom action process code and use .NET instead of learning Progress programming code. For any anyone not familiar with what I'm talking about, I'm referring to the 'Invoke .NET method' option for BPM actions. I have setup my BPMServer and everything communicates properly, but I'm not sure how I can code my .NET custom logic for setting some values in the 'tt' tables prior to an 'Update'.
>
>
> I am trying to replicate this Progress 4GL code in .NET:
>
> find first ttUD100 where ttUD100.RowMod='A' no-error.
> assign ttUD100.Date01 = NOW.
> assign ttUD100.Number01 = 1600.
>
> .NET Version in my custom Action logic:
>
> public virtual void OnBeforeUpdate(System.Data.DataTable ttUD100, System.Data.DataTable ttUD100Attch, System.Data.DataTable ttUD100A)
> {
> //
> // TODO: Replace the throw statement with any code for an action before UD100.GetaNewUD100() method invocation
> //
>
> Trace.WriteLine("PeteTest .NET Action Process START...");
> DataRow row = ttUD100.Rows[0];
> if (row["RowMod"].ToString() == "A")
> {
> row["Date01"] = DateTime.Now;
> row["Number01"] = 1600;
> Trace.WriteLine("RowValue:2 " + row["Key1"].ToString() + ", " + row["Date01"] + " " + row["Number01"] + ": DateTime.Now=" + DateTime.Now);
> }//end if
> Trace.WriteLine("PeteTest .NET Action Process END...");
>
> }
>
> I'm getting an error saying 'Date02 is null' when I try to set any of the row values,even if I'm actually setting Date02 field. If I comment out the lines where I'm trying to set the datafields and just output the values in the Trace Log everything works. It's just when I try change the value of a row field is where the error is generated. I would expect that I can use similar logic as the 4GL code and just assign the temporary table 'tt' fields, but I could be wrong.
>
> Does anyone have any sample of code of how to set datafields values in .NET that they are willing to share?
>