Reading the database in VB .NET

Yes it was very helpfull, do you know more of session variables?

Grzegorz Szczepanski

Dnia Tue, 5 Aug 2008 18:22:15 +0100
"Stephen Edginton" <stephene@...> napisał(a):

> These are some you can use in 4GL code.
>
>
>
> DCD-USERID
>
> CUR-PLANT
>
> CUR-COMP
>
>
>
> Hope this helps.
>
>
>
> Regards,
>
> Stephen
>
>
>
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On
> Behalf Of Robert Brown Sent: 05 August 2008 17:36
> To: vantage@yahoogroups.com
> Subject: Re: [Vantage] Reading the database in VB .NET
>
>
>
> Grzegorz,
>
> Nice work! That is some fine coding for someone who (in your origianl
> email) left the impression of being somewhat unfamiliar with .NET
> coding.
>
> While you clearly took a different path than my example, it looks
> like a much stronger process as a result. (Glad my lengthy email was
> of any help.)
>
> I'm new to BPM myself and would likely do you a disservice on how to
> detect the userID via 4GL. I would only recommended 2 things:
>
> (1) Set up a full detail trace and then Open the invoice app (and do
> nothing else). Open the trace log and do a text find/search on your
> userID. I'd be shocked if that doesn't lead you to trace sections
> that invoked BO methods (that expose the userID) that you can trap
> via 4GL.
>
> (2) "Ask Wonsil". Mark Wonsil (as well as several other regulars in
> the user group) are absolute whizzes at BPM/4GL.
>
> Rob Brown
>
> --- On Tue, 8/5/08, phoenix <phoenix_@... <mailto:phoenix_%40wp.pl>
> > wrote:
>
> From: phoenix <phoenix_@... <mailto:phoenix_%40wp.pl> >
> Subject: Re: [Vantage] Reading the database in VB .NET
> To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> Date: Tuesday, August 5, 2008, 5:00 AM
>
> Robert,
> Thank you for your answer, it was very helpfull.
> I have developed my own resolution, which basically force "save"
> action, each time when user is clicking particular field. So my code
> is like below:
> (I am tracking changes to PayHold and InvoiceHeld)
>
> BTW Do you know how can I obtain a session variables in 4GL - like
> Session.UserID, Session.UserName?
>
> *****c o d e*****
>
> Private Sub APInvHed_AfterField Change(ByVal sender As object, ByVal
> args As DataColumnChangeEve ntArgs) Handles APInvHed_Column.
> ColumnChanged '// ** Argument Properties and Uses ** '//
> args.Row("[FieldNam e]") '// args.Column, args.ProposedValue, args.Row
> '
> 'Add Event Handler Code
> '
> Dim sUserIdent As String = APInvoiceForm. Session.UserID
> Dim sNazwaUzyt As String = APInvoiceForm. Session.UserName
> Dim sCzasData As String
>
> If bZmiana = TRUE then
> PayHold = Ctype(csm.GetNative ControlReference ("13285910- 6101-4aab-
> 9526-e8cd723b621 b"),EpiCheckBox) InvoiceHeld = Ctype(csm.GetNative
> ControlReference ("e474fa10- 0be5-43b4- 9814-4a349805d1b
> f"),EpiCheckBox) Select Case args.Column. ColumnName
>
> Case "InvoiceHeld"
> If InvoiceHeld. Checked = False then
> If MessageBox.Show( "Czy akceptujesz tê faktury? ","Akceptacja
> faktury", MessageBoxButtons. OKCancel, _ Nothing, MessageBoxDefaultBu
> tton.Button1) = DialogResult. OK Then 'PayHold.Text = "Ze stanu
> zaznaczony wybra³e OK" & chr(13) & _ '"Teraz przycisk powinien byæ
> odznaczony" & chr(13) & _ 'sUserIdent & chr(13) & Now()
> sCzasData = Now()
> InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _
> "Zaakceptowa³ e fakturê" & chr(13) & _
> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
> MessageBox.Show( InvoiceHeld. Text,"Faktura zaakceptowana" )
> args.Row("Character 04") = args.Row("Character 04") & sUserIdent &
> ";" & sCzasData _ & ";" & "Akceptacja" & chr(13)
> oTrans.Update( 1)
> Else
> bZmiana = FALSE
> 'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _
> '"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
> 'sUserIdent & chr(13)& Now()
> InvoiceHeld. Text = "Zrezygnowa³e z akceptacji faktury," & chr(13) & _
> "faktura pozostaje nadal niezaakceptowana"
> MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a z akceptacji")
> args.Row("InvoiceHe ld")=TRUE
> End If
> Else
> If MessageBox.Show( "Czy chcesz wstrzymaæ tê fakturê? ","Wstrzymanie
> faktury", MessageBoxButtons. OKCancel, _ Nothing, MessageBoxDefaultBu
> tton.Button1) = DialogResult. OK Then 'PayHold.Text = "Ze stanu
> odznaczony wybra³e OK" & chr(13) & _ '"Teraz przycisk powinien byæ
> zaznaczony" & chr(13) & _ 'sUserIdent & chr(13) & Now()
> sCzasData = Now()
> InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _
> "Wstrzyma³e fakturê" & chr(13) & _
> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
> MessageBox.Show( InvoiceHeld. Text,"Faktura wstrzymana")
> args.Row("Character 04") = args.Row("Character 04") & sUserIdent &
> ";" & sCzasData _ & ";" & "Wstrzymanie" & chr(13)
> oTrans.Update( 1)
> Else
> bZmiana = FALSE
> 'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _
> '"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
> 'sUserIdent & chr(13) & Now()
> InvoiceHeld. Text = "Zrezygnowa³e ze wstrzymania faktury," & chr(13)
> & _ "faktura pozostaje nadal zaakceptowana"
> MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a ze wstrzymania" )
> args.Row("InvoiceHe ld")=FALSE
> End If
> End if
> bZmiana = TRUE
>
> Case "PayHold"
> If PayHold.Checked = False then
> If MessageBox.Show( "Czy akceptujesz p³atnoæ dla tej faktury?
> ","Akceptacja p³atnoci", MessageBoxButtons. OKCancel, _ Nothing,
> MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
> 'PayHold.Text = "Ze stanu zaznaczony wybra³e OK" & chr(13) & _
> '"Teraz przycisk powinien byæ odznaczony" & chr(13) & _ 'sUserIdent &
> chr(13) & Now() sCzasData = Now()
> PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
> "Zaakceptowa³ e p³atnoæ dla faktury" & chr(13) & _
> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
> MessageBox.Show( PayHold.Text, "P³atnoæ zaakceptowana" )
> args.Row("Character 03") = args.Row("Character 03") & sUserIdent &
> ";" & sCzasData _ & ";" & "Akceptacja" & chr(13)
> oTrans.Update( 1)
> Else
> bZmiana = FALSE
> 'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _
> '"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
> 'sUserIdent & chr(13)& Now()
> PayHold.Text = "Zrezygnowa³e z akceptacji p³atnoci," & chr(13) & _
> "p³atnoæ pozostaje nadal wstrzymana"
> MessageBox.Show( PayHold.Text, "Rezeygnacja z akceptacji")
> args.Row("PayHold" )=TRUE
> End If
> Else
> If MessageBox.Show( "Czy chcesz wstrzymaæ p³atnoæ dla tej faktury?
> ","Wstrzymanie p³atnoci", MessageBoxButtons. OKCancel, _ Nothing,
> MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
> 'PayHold.Text = "Ze stanu odznaczony wybra³e OK" & chr(13) & _
> '"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _ 'sUserIdent &
> chr(13) & Now() sCzasData = Now()
> PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
> "Wstrzyma³e p³atnoæ dla faktury" & chr(13) & _
> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
> MessageBox.Show( PayHold.Text, "P³atnoæ wstrzymana")
> args.Row("Character 03") = args.Row("Character 03") & sUserIdent &
> ";" & sCzasData _ & ";" & "Wstrzymanie" & chr(13)
> oTrans.Update( 1)
> Else
> bZmiana = FALSE
> 'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _
> '"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
> 'sUserIdent & chr(13) & Now()
> PayHold.Text = "Zrezygnowa³e ze wstrzymania p³atnoci," & chr(13) & _
> "p³atnoæ pozostaje nadal zaakceptowana"
> MessageBox.Show( PayHold.Text, "Rezeygnacja ze wstrzymania" )
> args.Row("PayHold" )=FALSE
> End If
> End if
> bZmiana = TRUE
> Case Else
> End Select
> End If 'bZmiana
> End Sub
>
> *****e n d o f c o d e*****
>
> Grzegorz Szczepañski
>
> Dnia Sat, 26 Jul 2008 09:51:50 -0700 (PDT)
> Robert Brown <robertb_versa@ yahoo.com> napisał(a):
>
> > I agree change log and auditing aren't perfect - but I've never seen
> > them NOT work. I've just seen instances where the logging was set up
> > against the wrong table.field.
> >
> > MUCH too easy to do as most apps have views that are redundant in
> > many (field) aspects - as they serve different app purposes - and
> > don't represent 'true' tables as defined in the data dictionary. If
> > you enable full tracing & mimic the action(s) in the app you wish to
> > capture activity history against, the 'true' table.field( s) being
> > updated (that you wish to set up for change log tracking or
> > auditing) will be revealed.
> >
> > Also, since (after re-reading your original post) it appears you are
> > trying to capture not actual written to db changes - but also user
> > actions creating a pending change that is then rejected and not
> > written to the db - you have left yourself with a very challenging
> > problem. (Why you want to track entered but rejected update actions
> > is beyond me - but that is your problem to justify).
> >
> > Let's assume you've thoroughly done that though and you are still
> > not getting what you want (eliminating the built in mechanisms as
> > possible solutions).
> >
> > That is likely because you are attempting to capture pending changes
> > that have a messagebox.show( "Y"/"N") (or 4GL equivalent) UI
> > selection interrupt within the BO/method "Update" routine that
> > either results in proceeding with or aborting the Update. Unless
> > Tracing shows otherwise, that is likely a 'black box' compiled code
> > UI object/method that offers no simple way to trap it and write the
> > results to your custom log.
> >
> > You'll have to get devious in order to accomplish what you want
> > (and, I warn you, the complexity of the customization will impact
> > perceived application responsiveness) . Being an Invoice app, it
> > hopefully won't be enough to thoroughly annoy users (as many
> > Vantage BASE apps are already painfully slow) and impact their
> > productivity.
> >
> > I assume you already already have Function code to capture the
> > current userID (on application load) and the current system
> > date/time every time an action you want to log occurs AND you've
> > assigned them some simple aliases (Ex.,: "cUserID" containing the
> > UserID value you captured on load and "cDateTime() " being a
> > callable function to get the exact current date/time as needed)
> >
> > For every native checkbox control you wish to track, create a custom
> > textbox linked to the same table/field. (Once you know your
> > customization is working, make them not-visible and, for good
> > measure, slide them off into a negative panel coordinate position -
> > as even 'not visible' controls sometimes bleed through and appear on
> > the screen - creating distractions to users.)
> >
> > Let's call these custom textboxes txtChk1, txtChk2, etc., for the
> > example.
> >
> > Because they are linked to boolean fields, they will either contain
> > null text values (if no Invoice record is loaded - a state
> > equivalent to having no record loaded in the app: "row= -1"),
> > "TRUE" (when the native checkbox is checked) or "FALSE" (when the
> > native checkbox is unchecked).
> >
> > Now, use your wizard to set up the shell of Subs for each custom
> > checkbox that will be triggered when _ChangedValue.
> >
> > At the module level, Dim a public text variable ("MyLog" for this
> > example).
> >
> > Also set up the necessary Private WithEvents declaration of your
> > dataview alias that contains the UD character field you are storing
> > your change log data in. Don't forget to add the code to initialize
> > it and enable read/write to it (and also destroy it when the app
> > closes).
> >
> > Let's assign this dataview(field) - field being the specific UD
> > character field holding your log record - an alias "MyLogViewVal" .
> >
> > Then, within each wizard generated Sub, add an If loop:
> >
> > If len(txtChk1. text) <> 0 Then
> >
> > End If
> >
> > This will prevent your code from generating errors when clearing the
> > app of a record.
> >
> > It is within each of these If loops that you will then add your code
> > to APPEND your change log record.
> >
> > If len(txtChk1. text) <> 0 Then
> > 'Capture the current value of your change log record and start
> > 'appending it.
> > MyLog = (MyLogViewVal & " ; " & cUserID & " " & cDateTime()
> > & _" txtChk1 value set to " & txtChk1.text)
> >
> > 'Now write back the appended info ONLY to the specific
> > 'table.udCharfield record where you are storing the log
> > '- NOT updating the entire table (or, worse yet, all tables in
> > the 'app)!
> >
> > MyLogViewVal = MyLog
> > ' You may or may not need this:
> > otrans.update( MyLogViewVal)
> >
> > End If
> >
> > Doing this within every Sub triggered by your custom txtChk# control
> > value changes will capture the interrum user changes BEFORE they are
> > written to the db.
> >
> > The last step is to determine (via tracing) what business object
> > adapter (& methods) are used to prompt the user to accept (& update
> > the db) or reject (and return the value(s) to their original state).
> >
> > Use your wizard again to trap the adapter (probably after_method)
> > and set up Cases that are invoked either after the user accepts the
> > pending changes and updates the db or rejects them.
> >
> > Within those two cases, once again insert code similar to above:
> >
> > Case "someMethod"
> > 'Whatever the method name is for Updating
> > 'and a second Case method for rejection of changes
> > MyLog = (MyLogViewVal & " ; Updated " & " " & cDateTime()
> > & _" Updated ")
> > ' replace " Updated " with something like " ChangeAborted "
> > ' with the Case "someMethod" invoked for rejecting the change.
> >
> > MyLogViewVal = MyLog
> > ' Again - You may or may not need this:
> > otrans.update( MyLogViewVal)
> >
> >
> > Not pretty - but it should work with proper code tweaks.
> >
> > My sympathies to you for whoever feels this is level of auditing is
> > needed.
> >
> > (Good training and management can't be replaced by heavy handed "big
> > brother is watching you" applications. )
> >
> > Rob Brown
> >
> >
> >
> >
> > --- On Sat, 7/26/08, phoenix <phoenix_@wp. pl> wrote:
> > From: phoenix <phoenix_@wp. pl>
> > Subject: Re: [Vantage] Reading the database in VB .NET
> > To: vantage@yahoogroups .com
> > Date: Saturday, July 26, 2008, 3:30 AM
> >
> > Robert,
> >
> > Several people already prove that change log is not always working.
> > So I decided to have my own change log on this particular fields
> > toogether with two text boxes on separeate sheet that are showing
> > the changes.
> >
> > I found that after the form is open I Just need a simple thing
> > Row.args("NameofFie ld") = Row.args("NameofFie ld") & "text to be
> > added"
> >
> > Now I Need to :
> >
> > 1. Find a way to refresh this text boxes each time the user is
> > clicking on the tab of this sheet - any suggestions?
> >
> > 2. Find a way to force SAVE action, oTrans.Update is not working
> > with some reasons. Maybe because I need to add some information
> > witch view a want to save?
> >
> > Grzegorz Szczepański
> >
> > Dnia Fri, 25 Jul :59: (PDT)
> > Robert Brown <robertb_versa@ yahoo.com> napisał(a):
> >
> > > Why not just utilize some combo of the built in change & audit
> > > logging?
> > >
> > >
> > > --- On Fri, 7/25/08, phoenix <phoenix_@wp. pl> wrote:
> > >
> > > From: phoenix <phoenix_@wp. pl>
> > > Subject: [Vantage] Reading the database in VB .NET
> > > To: vantage@yahoogroups .com
> > > Date: Friday, July 25, 2008, 3:54 AM
> > >
> > >
> > > I need to read some data from database using vb .net, can anyone
> > > help with that?
> >
> > > The scenario is like following:
> >
> > > I am tracking the changes that user is doing on some checkboxes
> > > within invoice entry. Each time when user is clicking this
> > > checkbox a message box is displayed with possibility to accept or
> > > reject the changes. All the above is done, now I need to: use a
> > > character field to write there some data about time and userid,
> > > like
> >
> > > :01.01 Accepted John Doe
> >
> > > :01.05 Rejected John Doe
> >
> > > and this is also not a problem,
> >
> > > I know how to update a character field within the dataset,
> > > But before applaying the changes I need to read the content of
> > > this filed in database and then ADD my changes, ( DO NOT replace
> > > it.)
> >
> > >
> > > Any help with code reading the context of database?
> >
> >
> >
> >
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
I need to read some data from database using vb .net, can anyone help
with that?
The scenario is like following:
I am tracking the changes that user is doing on some checkboxes within invoice entry. Each time
when user is clicking this checkbox a message box is displayed with
possibility to accept or reject the changes. All the above is done, now
I need to: use a character field to write there some data about time
and userid, like
2007-08-09 12:01.01 Accepted John Doe
2007-08-10 12:01.05 Rejected John Doe
and this is also not a problem,
I know how to update a character field within the dataset,
But before applaying the changes I need to read the content of this
filed in database and then ADD my changes, ( DO NOT replace it.)

Any help with code reading the context of database?
Why not just utilize some combo of the built in change & audit logging?
Â


--- On Fri, 7/25/08, phoenix <phoenix_@...> wrote:

From: phoenix <phoenix_@...>
Subject: [Vantage] Reading the database in VB .NET
To: vantage@yahoogroups.com
Date: Friday, July 25, 2008, 3:54 AM






I need to read some data from database using vb .net, can anyone help
with that?
The scenario is like following:
I am tracking the changes that user is doing on some checkboxes within invoice entry. Each time
when user is clicking this checkbox a message box is displayed with
possibility to accept or reject the changes. All the above is done, now
I need to: use a character field to write there some data about time
and userid, like
2007-08-09 12:01.01 Accepted John Doe
2007-08-10 12:01.05 Rejected John Doe
and this is also not a problem,
I know how to update a character field within the dataset,
But before applaying the changes I need to read the content of this
filed in database and then ADD my changes, ( DO NOT replace it.)

Any help with code reading the context of database?

















[Non-text portions of this message have been removed]
Robert,
Several people already prove that change log is not always working. So
I decided to have my own change log on this particular fields toogether
with two text boxes on separeate sheet that are showing the changes.

I found that after the form is open I Just need a simple thing
Row.args("NameofField") = Row.args("NameofField") & "text to be added"

Now I Need to :
1. Find a way to refresh this text boxes each time the user is clicking
on the tab of this sheet - any suggestions?

2. Find a way to force SAVE action, oTrans.Update is not working with
some reasons. Maybe because I need to add some information witch view a
want to save?

Grzegorz Szczepański

Dnia Fri, 25 Jul 2008 08:59:28 -0700 (PDT)
Robert Brown <robertb_versa@...> napisał(a):

> Why not just utilize some combo of the built in change & audit
> logging?
>
>
> --- On Fri, 7/25/08, phoenix <phoenix_@...> wrote:
>
> From: phoenix <phoenix_@...>
> Subject: [Vantage] Reading the database in VB .NET
> To: vantage@yahoogroups.com
> Date: Friday, July 25, 2008, 3:54 AM
>
>
>
>
>
>
> I need to read some data from database using vb .net, can anyone help
> with that?
> The scenario is like following:
> I am tracking the changes that user is doing on some checkboxes
> within invoice entry. Each time when user is clicking this checkbox a
> message box is displayed with possibility to accept or reject the
> changes. All the above is done, now I need to: use a character field
> to write there some data about time and userid, like
> 2007-08-09 12:01.01 Accepted John Doe
> 2007-08-10 12:01.05 Rejected John Doe
> and this is also not a problem,
> I know how to update a character field within the dataset,
> But before applaying the changes I need to read the content of this
> filed in database and then ADD my changes, ( DO NOT replace it.)
>
> Any help with code reading the context of database?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
I agree change log and auditing aren't perfect - but I've never seen them NOT work. I've just seen instances where the logging was set up against the wrong table.field.

MUCH too easy to do as most apps have views that are redundant in many (field) aspects - as they serve different app purposes - and don't represent 'true' tables as defined in the data dictionary. If you enable full tracing & mimic the action(s) in the app you wish to capture activity history against, the 'true' table.field(s) being updated (that you wish to set up for change log tracking or auditing) will be revealed.

Also, since (after re-reading your original post) it appears you are trying to capture not actual written to db changes - but also user actions creating a pending change that is then rejected and not written to the db - you have left yourself with a very challenging problem. (Why you want to track entered but rejected update actions is beyond me - but that is your problem to justify).

Let's assume you've thoroughly done that though and you are still not getting what you want (eliminating the built in mechanisms as possible solutions).

That is likely because you are attempting to capture pending changes that have a messagebox.show("Y"/"N") (or 4GL equivalent) UI selection interrupt within the BO/method "Update" routine that either results in proceeding with or aborting the Update. Unless Tracing shows otherwise, that is likely a 'black box' compiled code UI object/method that offers no simple way to trap it and write the results to your custom log.

You'll have to get devious in order to accomplish what you want (and, I warn you, the complexity of the customization will impact perceived application responsiveness). Being an Invoice app, it hopefully won't be enough to thoroughly annoy users (as many Vantage BASE apps are already painfully slow) and impact their productivity.

I assume you already already have Function code to capture the current userID (on application load) and the current system date/time every time an action you want to log occurs AND you've assigned them some simple aliases (Ex.,: "cUserID" containing the UserID value you captured on load and "cDateTime()" being a callable function to get the exact current date/time as needed)

For every native checkbox control you wish to track, create a custom textbox linked to the same table/field. (Once you know your customization is working, make them not-visible and, for good measure, slide them off into a negative panel coordinate position - as even 'not visible' controls sometimes bleed through and appear on the screen - creating distractions to users.)

Let's call these custom textboxes txtChk1, txtChk2, etc., for the example.

Because they are linked to boolean fields, they will either contain null text values (if no Invoice record is loaded - a state equivalent to having no record loaded in the app: "row= -1"), "TRUE" (when the native checkbox is checked) or "FALSE" (when the native checkbox is unchecked).

Now, use your wizard to set up the shell of Subs for each custom checkbox that will be triggered when _ChangedValue.

At the module level, Dim a public text variable ("MyLog" for this example).

Also set up the necessary Private WithEvents declaration of your dataview alias that contains the UD character field you are storing your change log data in. Don't forget to add the code to initialize it and enable read/write to it (and also destroy it when the app closes).

Let's assign this dataview(field) - field being the specific UD character field holding your log record - an alias "MyLogViewVal".

Then, within each wizard generated Sub, add an If loop:

If len(txtChk1.text) <> 0 Then

End If

This will prevent your code from generating errors when clearing the app of a record.

It is within each of these If loops that you will then add your code to APPEND your change log record.

If len(txtChk1.text) <> 0 Then
'Capture the current value of your change log record and start
'appending it.
MyLog = (MyLogViewVal & " ; " & cUserID & " " & cDateTime() &
_" txtChk1 value set to " & txtChk1.text)

'Now write back the appended info ONLY to the specific
'table.udCharfield record where you are storing the log
'- NOT updating the entire table (or, worse yet, all tables in the
'app)!

MyLogViewVal = MyLog
' You may or may not need this:
otrans.update(MyLogViewVal)

End If

Doing this within every Sub triggered by your custom txtChk# control value changes will capture the interrum user changes BEFORE they are written to the db.

The last step is to determine (via tracing) what business object adapter (& methods) are used to prompt the user to accept (& update the db) or reject (and return the value(s) to their original state).

Use your wizard again to trap the adapter (probably after_method) and set up Cases that are invoked either after the user accepts the pending changes and updates the db or rejects them.

Within those two cases, once again insert code similar to above:

Case "someMethod"
'Whatever the method name is for Updating
'and a second Case method for rejection of changes
MyLog = (MyLogViewVal & " ; Updated " & " " & cDateTime() &
_" Updated ")
' replace " Updated " with something like " ChangeAborted "
' with the Case "someMethod" invoked for rejecting the change.

MyLogViewVal = MyLog
' Again - You may or may not need this:
otrans.update(MyLogViewVal)


Not pretty - but it should work with proper code tweaks.

My sympathies to you for whoever feels this is level of auditing is needed.

(Good training and management can't be replaced by heavy handed "big brother is watching you" applications.)

Rob Brown




--- On Sat, 7/26/08, phoenix <phoenix_@...> wrote:
From: phoenix <phoenix_@...>
Subject: Re: [Vantage] Reading the database in VB .NET
To: vantage@yahoogroups.com
Date: Saturday, July 26, 2008, 3:30 AM

Robert,

Several people already prove that change log is not always working. So
I decided to have my own change log on this particular fields toogether
with two text boxes on separeate sheet that are showing the changes.

I found that after the form is open I Just need a simple thing
Row.args("NameofFie ld") = Row.args("NameofFie ld") & "text to be added"

Now I Need to :

1. Find a way to refresh this text boxes each time the user is clicking
on the tab of this sheet - any suggestions?

2. Find a way to force SAVE action, oTrans.Update is not working with
some reasons. Maybe because I need to add some information witch view a
want to save?

Grzegorz Szczepański

Dnia Fri, 25 Jul :59: (PDT)
Robert Brown <robertb_versa@ yahoo.com> napisał(a):

> Why not just utilize some combo of the built in change & audit
> logging?
>
>
> --- On Fri, 7/25/08, phoenix <phoenix_@wp. pl> wrote:
>
> From: phoenix <phoenix_@wp. pl>
> Subject: [Vantage] Reading the database in VB .NET
> To: vantage@yahoogroups .com
> Date: Friday, July 25, 2008, 3:54 AM
>
>
> I need to read some data from database using vb .net, can anyone help
> with that?

> The scenario is like following:

> I am tracking the changes that user is doing on some checkboxes
> within invoice entry. Each time when user is clicking this checkbox a
> message box is displayed with possibility to accept or reject the
> changes. All the above is done, now I need to: use a character field
> to write there some data about time and userid, like

> :01.01 Accepted John Doe

> :01.05 Rejected John Doe

> and this is also not a problem,

> I know how to update a character field within the dataset,
> But before applaying the changes I need to read the content of this
> filed in database and then ADD my changes, ( DO NOT replace it.)

>
> Any help with code reading the context of database?
Robert,
Thank you for your answer, it was very helpfull.
I have developed my own resolution, which basically force "save"
action, each time when user is clicking particular field. So my code is
like below:
(I am tracking changes to PayHold and InvoiceHeld)

BTW Do you know how can I obtain a session variables in 4GL - like
Session.UserID, Session.UserName?

*****c o d e*****

Private Sub APInvHed_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles APInvHed_Column.ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Dim sUserIdent As String = APInvoiceForm.Session.UserID
Dim sNazwaUzyt As String = APInvoiceForm.Session.UserName
Dim sCzasData As String

If bZmiana = TRUE then
PayHold = Ctype(csm.GetNativeControlReference("13285910-6101-4aab-9526-e8cd723b621b"),EpiCheckBox)
InvoiceHeld = Ctype(csm.GetNativeControlReference("e474fa10-0be5-43b4-9814-4a349805d1bf"),EpiCheckBox)
Select Case args.Column.ColumnName

Case "InvoiceHeld"
If InvoiceHeld.Checked = False then
If MessageBox.Show("Czy akceptujesz tê faktury? ","Akceptacja faktury", MessageBoxButtons.OKCancel, _
Nothing, MessageBoxDefaultButton.Button1) = DialogResult.OK Then
'PayHold.Text = "Ze stanu zaznaczony wybra³eœ OK" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
InvoiceHeld.Text = sNazwaUzyt & chr(13) & chr(13) & _
"Zaakceptowa³eœ fakturê" & chr(13) & _
"numer: " & args.Row("InvoiceNum") & chr(13) & chr(13) & sCzasData
MessageBox.Show(InvoiceHeld.Text,"Faktura zaakceptowana")
args.Row("Character04") = args.Row("Character04") & sUserIdent & ";" & sCzasData _
& ";" & "Akceptacja" & chr(13)
oTrans.Update(1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu zaznaczony wybra³eœ Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13)& Now()
InvoiceHeld.Text = "Zrezygnowa³eœ z akceptacji faktury," & chr(13) & _
"faktura pozostaje nadal niezaakceptowana"
MessageBox.Show(InvoiceHeld.Text,"Rezeygnacja z akceptacji")
args.Row("InvoiceHeld")=TRUE
End If
Else
If MessageBox.Show("Czy chcesz wstrzymaæ tê fakturê? ","Wstrzymanie faktury", MessageBoxButtons.OKCancel, _
Nothing, MessageBoxDefaultButton.Button1) = DialogResult.OK Then
'PayHold.Text = "Ze stanu odznaczony wybra³eœ OK" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
InvoiceHeld.Text = sNazwaUzyt & chr(13) & chr(13) & _
"Wstrzyma³eœ fakturê" & chr(13) & _
"numer: " & args.Row("InvoiceNum") & chr(13) & chr(13) & sCzasData
MessageBox.Show(InvoiceHeld.Text,"Faktura wstrzymana")
args.Row("Character04") = args.Row("Character04") & sUserIdent & ";" & sCzasData _
& ";" & "Wstrzymanie" & chr(13)
oTrans.Update(1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu odznaczony wybra³eœ Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
InvoiceHeld.Text = "Zrezygnowa³eœ ze wstrzymania faktury," & chr(13) & _
"faktura pozostaje nadal zaakceptowana"
MessageBox.Show(InvoiceHeld.Text,"Rezeygnacja ze wstrzymania")
args.Row("InvoiceHeld")=FALSE
End If
End if
bZmiana = TRUE

Case "PayHold"
If PayHold.Checked = False then
If MessageBox.Show("Czy akceptujesz p³atnoœæ dla tej faktury? ","Akceptacja p³atnoœci", MessageBoxButtons.OKCancel, _
Nothing, MessageBoxDefaultButton.Button1) = DialogResult.OK Then
'PayHold.Text = "Ze stanu zaznaczony wybra³eœ OK" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
"Zaakceptowa³eœ p³atnoœæ dla faktury" & chr(13) & _
"numer: " & args.Row("InvoiceNum") & chr(13) & chr(13) & sCzasData
MessageBox.Show(PayHold.Text,"P³atnoœæ zaakceptowana")
args.Row("Character03") = args.Row("Character03") & sUserIdent & ";" & sCzasData _
& ";" & "Akceptacja" & chr(13)
oTrans.Update(1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu zaznaczony wybra³eœ Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13)& Now()
PayHold.Text = "Zrezygnowa³eœ z akceptacji p³atnoœci," & chr(13) & _
"p³atnoœæ pozostaje nadal wstrzymana"
MessageBox.Show(PayHold.Text,"Rezeygnacja z akceptacji")
args.Row("PayHold")=TRUE
End If
Else
If MessageBox.Show("Czy chcesz wstrzymaæ p³atnoœæ dla tej faktury? ","Wstrzymanie p³atnoœci", MessageBoxButtons.OKCancel, _
Nothing, MessageBoxDefaultButton.Button1) = DialogResult.OK Then
'PayHold.Text = "Ze stanu odznaczony wybra³eœ OK" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
"Wstrzyma³eœ p³atnoœæ dla faktury" & chr(13) & _
"numer: " & args.Row("InvoiceNum") & chr(13) & chr(13) & sCzasData
MessageBox.Show(PayHold.Text,"P³atnoœæ wstrzymana")
args.Row("Character03") = args.Row("Character03") & sUserIdent & ";" & sCzasData _
& ";" & "Wstrzymanie" & chr(13)
oTrans.Update(1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu odznaczony wybra³eœ Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
PayHold.Text = "Zrezygnowa³eœ ze wstrzymania p³atnoœci," & chr(13) & _
"p³atnoœæ pozostaje nadal zaakceptowana"
MessageBox.Show(PayHold.Text,"Rezeygnacja ze wstrzymania")
args.Row("PayHold")=FALSE
End If
End if
bZmiana = TRUE
Case Else
End Select
End If 'bZmiana
End Sub

*****e n d o f c o d e*****

Grzegorz Szczepañski

Dnia Sat, 26 Jul 2008 09:51:50 -0700 (PDT)
Robert Brown <robertb_versa@...> napisał(a):

> I agree change log and auditing aren't perfect - but I've never seen
> them NOT work. I've just seen instances where the logging was set up
> against the wrong table.field.
>
> MUCH too easy to do as most apps have views that are redundant in
> many (field) aspects - as they serve different app purposes - and
> don't represent 'true' tables as defined in the data dictionary. If
> you enable full tracing & mimic the action(s) in the app you wish to
> capture activity history against, the 'true' table.field(s) being
> updated (that you wish to set up for change log tracking or auditing)
> will be revealed.
>
> Also, since (after re-reading your original post) it appears you are
> trying to capture not actual written to db changes - but also user
> actions creating a pending change that is then rejected and not
> written to the db - you have left yourself with a very challenging
> problem. (Why you want to track entered but rejected update actions
> is beyond me - but that is your problem to justify).
>
> Let's assume you've thoroughly done that though and you are still not
> getting what you want (eliminating the built in mechanisms as
> possible solutions).
>
> That is likely because you are attempting to capture pending changes
> that have a messagebox.show("Y"/"N") (or 4GL equivalent) UI selection
> interrupt within the BO/method "Update" routine that either results
> in proceeding with or aborting the Update. Unless Tracing shows
> otherwise, that is likely a 'black box' compiled code UI
> object/method that offers no simple way to trap it and write the
> results to your custom log.
>
> You'll have to get devious in order to accomplish what you want (and,
> I warn you, the complexity of the customization will impact perceived
> application responsiveness). Being an Invoice app, it hopefully won't
> be enough to thoroughly annoy users (as many Vantage BASE apps are
> already painfully slow) and impact their productivity.
>
> I assume you already already have Function code to capture the
> current userID (on application load) and the current system date/time
> every time an action you want to log occurs AND you've assigned them
> some simple aliases (Ex.,: "cUserID" containing the UserID value you
> captured on load and "cDateTime()" being a callable function to get
> the exact current date/time as needed)
>
> For every native checkbox control you wish to track, create a custom
> textbox linked to the same table/field. (Once you know your
> customization is working, make them not-visible and, for good
> measure, slide them off into a negative panel coordinate position -
> as even 'not visible' controls sometimes bleed through and appear on
> the screen - creating distractions to users.)
>
> Let's call these custom textboxes txtChk1, txtChk2, etc., for the
> example.
>
> Because they are linked to boolean fields, they will either contain
> null text values (if no Invoice record is loaded - a state equivalent
> to having no record loaded in the app: "row= -1"), "TRUE" (when the
> native checkbox is checked) or "FALSE" (when the native checkbox is
> unchecked).
>
> Now, use your wizard to set up the shell of Subs for each custom
> checkbox that will be triggered when _ChangedValue.
>
> At the module level, Dim a public text variable ("MyLog" for this
> example).
>
> Also set up the necessary Private WithEvents declaration of your
> dataview alias that contains the UD character field you are storing
> your change log data in. Don't forget to add the code to initialize
> it and enable read/write to it (and also destroy it when the app
> closes).
>
> Let's assign this dataview(field) - field being the specific UD
> character field holding your log record - an alias "MyLogViewVal".
>
> Then, within each wizard generated Sub, add an If loop:
>
> If len(txtChk1.text) <> 0 Then
>
> End If
>
> This will prevent your code from generating errors when clearing the
> app of a record.
>
> It is within each of these If loops that you will then add your code
> to APPEND your change log record.
>
> If len(txtChk1.text) <> 0 Then
> 'Capture the current value of your change log record and start
> 'appending it.
> MyLog = (MyLogViewVal & " ; " & cUserID & " " & cDateTime()
> & _" txtChk1 value set to " & txtChk1.text)
>
> 'Now write back the appended info ONLY to the specific
> 'table.udCharfield record where you are storing the log
> '- NOT updating the entire table (or, worse yet, all tables in
> the 'app)!
>
> MyLogViewVal = MyLog
> ' You may or may not need this:
> otrans.update(MyLogViewVal)
>
> End If
>
> Doing this within every Sub triggered by your custom txtChk# control
> value changes will capture the interrum user changes BEFORE they are
> written to the db.
>
> The last step is to determine (via tracing) what business object
> adapter (& methods) are used to prompt the user to accept (& update
> the db) or reject (and return the value(s) to their original state).
>
> Use your wizard again to trap the adapter (probably after_method) and
> set up Cases that are invoked either after the user accepts the
> pending changes and updates the db or rejects them.
>
> Within those two cases, once again insert code similar to above:
>
> Case "someMethod"
> 'Whatever the method name is for Updating
> 'and a second Case method for rejection of changes
> MyLog = (MyLogViewVal & " ; Updated " & " " & cDateTime()
> & _" Updated ")
> ' replace " Updated " with something like " ChangeAborted "
> ' with the Case "someMethod" invoked for rejecting the change.
>
> MyLogViewVal = MyLog
> ' Again - You may or may not need this:
> otrans.update(MyLogViewVal)
>
>
> Not pretty - but it should work with proper code tweaks.
>
> My sympathies to you for whoever feels this is level of auditing is
> needed.
>
> (Good training and management can't be replaced by heavy handed "big
> brother is watching you" applications.)
>
> Rob Brown
>
>
>
>
> --- On Sat, 7/26/08, phoenix <phoenix_@...> wrote:
> From: phoenix <phoenix_@...>
> Subject: Re: [Vantage] Reading the database in VB .NET
> To: vantage@yahoogroups.com
> Date: Saturday, July 26, 2008, 3:30 AM
>
> Robert,
>
> Several people already prove that change log is not always working. So
> I decided to have my own change log on this particular fields
> toogether with two text boxes on separeate sheet that are showing the
> changes.
>
> I found that after the form is open I Just need a simple thing
> Row.args("NameofFie ld") = Row.args("NameofFie ld") & "text to be
> added"
>
> Now I Need to :
>
> 1. Find a way to refresh this text boxes each time the user is
> clicking on the tab of this sheet - any suggestions?
>
> 2. Find a way to force SAVE action, oTrans.Update is not working with
> some reasons. Maybe because I need to add some information witch view
> a want to save?
>
> Grzegorz Szczepański
>
> Dnia Fri, 25 Jul :59: (PDT)
> Robert Brown <robertb_versa@ yahoo.com> napisał(a):
>
> > Why not just utilize some combo of the built in change & audit
> > logging?
> >
> >
> > --- On Fri, 7/25/08, phoenix <phoenix_@wp. pl> wrote:
> >
> > From: phoenix <phoenix_@wp. pl>
> > Subject: [Vantage] Reading the database in VB .NET
> > To: vantage@yahoogroups .com
> > Date: Friday, July 25, 2008, 3:54 AM
> >
> >
> > I need to read some data from database using vb .net, can anyone
> > help with that?
>
> > The scenario is like following:
>
> > I am tracking the changes that user is doing on some checkboxes
> > within invoice entry. Each time when user is clicking this checkbox
> > a message box is displayed with possibility to accept or reject the
> > changes. All the above is done, now I need to: use a character field
> > to write there some data about time and userid, like
>
> > :01.01 Accepted John Doe
>
> > :01.05 Rejected John Doe
>
> > and this is also not a problem,
>
> > I know how to update a character field within the dataset,
> > But before applaying the changes I need to read the content of this
> > filed in database and then ADD my changes, ( DO NOT replace it.)
>
> >
> > Any help with code reading the context of database?
>
>
>
>
Grzegorz,

Nice work! That is some fine coding for someone who (in your origianl email) left the impression of being somewhat unfamiliar with .NET coding.

While you clearly took a different path than my example, it looks like a much stronger process as a result. (Glad my lengthy email was of any help.)

I'm new to BPM myself and would likely do you a disservice on how to detect the userID via 4GL. I would only recommended 2 things:

(1) Set up a full detail trace and then Open the invoice app (and do nothing else). Open the trace log and do a text find/search on your userID. I'd be shocked if that doesn't lead you to trace sections that invoked BO methods (that expose the userID) that you can trap via 4GL.

(2) "Ask Wonsil". Mark Wonsil (as well as several other regulars in the user group) are absolute whizzes at BPM/4GL.

Rob Brown

--- On Tue, 8/5/08, phoenix <phoenix_@...> wrote:

From: phoenix <phoenix_@...>
Subject: Re: [Vantage] Reading the database in VB .NET
To: vantage@yahoogroups.com
Date: Tuesday, August 5, 2008, 5:00 AM






Robert,
Thank you for your answer, it was very helpfull.
I have developed my own resolution, which basically force "save"
action, each time when user is clicking particular field. So my code is
like below:
(I am tracking changes to PayHold and InvoiceHeld)

BTW Do you know how can I obtain a session variables in 4GL - like
Session.UserID, Session.UserName?

*****c o d e*****

Private Sub APInvHed_AfterField Change(ByVal sender As object, ByVal args As DataColumnChangeEve ntArgs) Handles APInvHed_Column. ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldNam e]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Dim sUserIdent As String = APInvoiceForm. Session.UserID
Dim sNazwaUzyt As String = APInvoiceForm. Session.UserName
Dim sCzasData As String

If bZmiana = TRUE then
PayHold = Ctype(csm.GetNative ControlReference ("13285910- 6101-4aab- 9526-e8cd723b621 b"),EpiCheckBox)
InvoiceHeld = Ctype(csm.GetNative ControlReference ("e474fa10- 0be5-43b4- 9814-4a349805d1b f"),EpiCheckBox)
Select Case args.Column. ColumnName

Case "InvoiceHeld"
If InvoiceHeld. Checked = False then
If MessageBox.Show( "Czy akceptujesz tê faktury? ","Akceptacja faktury", MessageBoxButtons. OKCancel, _
Nothing, MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
'PayHold.Text = "Ze stanu zaznaczony wybra³e OK" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _
"Zaakceptowa³ e fakturê" & chr(13) & _
"numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
MessageBox.Show( InvoiceHeld. Text,"Faktura zaakceptowana" )
args.Row("Character 04") = args.Row("Character 04") & sUserIdent & ";" & sCzasData _
& ";" & "Akceptacja" & chr(13)
oTrans.Update( 1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13)& Now()
InvoiceHeld. Text = "Zrezygnowa³e z akceptacji faktury," & chr(13) & _
"faktura pozostaje nadal niezaakceptowana"
MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a z akceptacji")
args.Row("InvoiceHe ld")=TRUE
End If
Else
If MessageBox.Show( "Czy chcesz wstrzymaæ tê fakturê? ","Wstrzymanie faktury", MessageBoxButtons. OKCancel, _
Nothing, MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
'PayHold.Text = "Ze stanu odznaczony wybra³e OK" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _
"Wstrzyma³e fakturê" & chr(13) & _
"numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
MessageBox.Show( InvoiceHeld. Text,"Faktura wstrzymana")
args.Row("Character 04") = args.Row("Character 04") & sUserIdent & ";" & sCzasData _
& ";" & "Wstrzymanie" & chr(13)
oTrans.Update( 1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
InvoiceHeld. Text = "Zrezygnowa³e ze wstrzymania faktury," & chr(13) & _
"faktura pozostaje nadal zaakceptowana"
MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a ze wstrzymania" )
args.Row("InvoiceHe ld")=FALSE
End If
End if
bZmiana = TRUE

Case "PayHold"
If PayHold.Checked = False then
If MessageBox.Show( "Czy akceptujesz p³atnoæ dla tej faktury? ","Akceptacja p³atnoci", MessageBoxButtons. OKCancel, _
Nothing, MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
'PayHold.Text = "Ze stanu zaznaczony wybra³e OK" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
"Zaakceptowa³ e p³atnoæ dla faktury" & chr(13) & _
"numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
MessageBox.Show( PayHold.Text, "P³atnoæ zaakceptowana" )
args.Row("Character 03") = args.Row("Character 03") & sUserIdent & ";" & sCzasData _
& ";" & "Akceptacja" & chr(13)
oTrans.Update( 1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13)& Now()
PayHold.Text = "Zrezygnowa³e z akceptacji p³atnoci," & chr(13) & _
"p³atnoæ pozostaje nadal wstrzymana"
MessageBox.Show( PayHold.Text, "Rezeygnacja z akceptacji")
args.Row("PayHold" )=TRUE
End If
Else
If MessageBox.Show( "Czy chcesz wstrzymaæ p³atnoæ dla tej faktury? ","Wstrzymanie p³atnoci", MessageBoxButtons. OKCancel, _
Nothing, MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
'PayHold.Text = "Ze stanu odznaczony wybra³e OK" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
"Wstrzyma³e p³atnoæ dla faktury" & chr(13) & _
"numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
MessageBox.Show( PayHold.Text, "P³atnoæ wstrzymana")
args.Row("Character 03") = args.Row("Character 03") & sUserIdent & ";" & sCzasData _
& ";" & "Wstrzymanie" & chr(13)
oTrans.Update( 1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
PayHold.Text = "Zrezygnowa³e ze wstrzymania p³atnoci," & chr(13) & _
"p³atnoæ pozostaje nadal zaakceptowana"
MessageBox.Show( PayHold.Text, "Rezeygnacja ze wstrzymania" )
args.Row("PayHold" )=FALSE
End If
End if
bZmiana = TRUE
Case Else
End Select
End If 'bZmiana
End Sub

*****e n d o f c o d e*****

Grzegorz Szczepañski

Dnia Sat, 26 Jul 2008 09:51:50 -0700 (PDT)
Robert Brown <robertb_versa@ yahoo.com> napisał(a):

> I agree change log and auditing aren't perfect - but I've never seen
> them NOT work. I've just seen instances where the logging was set up
> against the wrong table.field.
>
> MUCH too easy to do as most apps have views that are redundant in
> many (field) aspects - as they serve different app purposes - and
> don't represent 'true' tables as defined in the data dictionary. If
> you enable full tracing & mimic the action(s) in the app you wish to
> capture activity history against, the 'true' table.field( s) being
> updated (that you wish to set up for change log tracking or auditing)
> will be revealed.
>
> Also, since (after re-reading your original post) it appears you are
> trying to capture not actual written to db changes - but also user
> actions creating a pending change that is then rejected and not
> written to the db - you have left yourself with a very challenging
> problem. (Why you want to track entered but rejected update actions
> is beyond me - but that is your problem to justify).
>
> Let's assume you've thoroughly done that though and you are still not
> getting what you want (eliminating the built in mechanisms as
> possible solutions).
>
> That is likely because you are attempting to capture pending changes
> that have a messagebox.show( "Y"/"N") (or 4GL equivalent) UI selection
> interrupt within the BO/method "Update" routine that either results
> in proceeding with or aborting the Update. Unless Tracing shows
> otherwise, that is likely a 'black box' compiled code UI
> object/method that offers no simple way to trap it and write the
> results to your custom log.
>
> You'll have to get devious in order to accomplish what you want (and,
> I warn you, the complexity of the customization will impact perceived
> application responsiveness) . Being an Invoice app, it hopefully won't
> be enough to thoroughly annoy users (as many Vantage BASE apps are
> already painfully slow) and impact their productivity.
>
> I assume you already already have Function code to capture the
> current userID (on application load) and the current system date/time
> every time an action you want to log occurs AND you've assigned them
> some simple aliases (Ex.,: "cUserID" containing the UserID value you
> captured on load and "cDateTime() " being a callable function to get
> the exact current date/time as needed)
>
> For every native checkbox control you wish to track, create a custom
> textbox linked to the same table/field. (Once you know your
> customization is working, make them not-visible and, for good
> measure, slide them off into a negative panel coordinate position -
> as even 'not visible' controls sometimes bleed through and appear on
> the screen - creating distractions to users.)
>
> Let's call these custom textboxes txtChk1, txtChk2, etc., for the
> example.
>
> Because they are linked to boolean fields, they will either contain
> null text values (if no Invoice record is loaded - a state equivalent
> to having no record loaded in the app: "row= -1"), "TRUE" (when the
> native checkbox is checked) or "FALSE" (when the native checkbox is
> unchecked).
>
> Now, use your wizard to set up the shell of Subs for each custom
> checkbox that will be triggered when _ChangedValue.
>
> At the module level, Dim a public text variable ("MyLog" for this
> example).
>
> Also set up the necessary Private WithEvents declaration of your
> dataview alias that contains the UD character field you are storing
> your change log data in. Don't forget to add the code to initialize
> it and enable read/write to it (and also destroy it when the app
> closes).
>
> Let's assign this dataview(field) - field being the specific UD
> character field holding your log record - an alias "MyLogViewVal" .
>
> Then, within each wizard generated Sub, add an If loop:
>
> If len(txtChk1. text) <> 0 Then
>
> End If
>
> This will prevent your code from generating errors when clearing the
> app of a record.
>
> It is within each of these If loops that you will then add your code
> to APPEND your change log record.
>
> If len(txtChk1. text) <> 0 Then
> 'Capture the current value of your change log record and start
> 'appending it.
> MyLog = (MyLogViewVal & " ; " & cUserID & " " & cDateTime()
> & _" txtChk1 value set to " & txtChk1.text)
>
> 'Now write back the appended info ONLY to the specific
> 'table.udCharfield record where you are storing the log
> '- NOT updating the entire table (or, worse yet, all tables in
> the 'app)!
>
> MyLogViewVal = MyLog
> ' You may or may not need this:
> otrans.update( MyLogViewVal)
>
> End If
>
> Doing this within every Sub triggered by your custom txtChk# control
> value changes will capture the interrum user changes BEFORE they are
> written to the db.
>
> The last step is to determine (via tracing) what business object
> adapter (& methods) are used to prompt the user to accept (& update
> the db) or reject (and return the value(s) to their original state).
>
> Use your wizard again to trap the adapter (probably after_method) and
> set up Cases that are invoked either after the user accepts the
> pending changes and updates the db or rejects them.
>
> Within those two cases, once again insert code similar to above:
>
> Case "someMethod"
> 'Whatever the method name is for Updating
> 'and a second Case method for rejection of changes
> MyLog = (MyLogViewVal & " ; Updated " & " " & cDateTime()
> & _" Updated ")
> ' replace " Updated " with something like " ChangeAborted "
> ' with the Case "someMethod" invoked for rejecting the change.
>
> MyLogViewVal = MyLog
> ' Again - You may or may not need this:
> otrans.update( MyLogViewVal)
>
>
> Not pretty - but it should work with proper code tweaks.
>
> My sympathies to you for whoever feels this is level of auditing is
> needed.
>
> (Good training and management can't be replaced by heavy handed "big
> brother is watching you" applications. )
>
> Rob Brown
>
>
>
>
> --- On Sat, 7/26/08, phoenix <phoenix_@wp. pl> wrote:
> From: phoenix <phoenix_@wp. pl>
> Subject: Re: [Vantage] Reading the database in VB .NET
> To: vantage@yahoogroups .com
> Date: Saturday, July 26, 2008, 3:30 AM
>
> Robert,
>
> Several people already prove that change log is not always working. So
> I decided to have my own change log on this particular fields
> toogether with two text boxes on separeate sheet that are showing the
> changes.
>
> I found that after the form is open I Just need a simple thing
> Row.args("NameofFie ld") = Row.args("NameofFie ld") & "text to be
> added"
>
> Now I Need to :
>
> 1. Find a way to refresh this text boxes each time the user is
> clicking on the tab of this sheet - any suggestions?
>
> 2. Find a way to force SAVE action, oTrans.Update is not working with
> some reasons. Maybe because I need to add some information witch view
> a want to save?
>
> Grzegorz Szczepański
>
> Dnia Fri, 25 Jul :59: (PDT)
> Robert Brown <robertb_versa@ yahoo.com> napisał(a):
>
> > Why not just utilize some combo of the built in change & audit
> > logging?
> >
> >
> > --- On Fri, 7/25/08, phoenix <phoenix_@wp. pl> wrote:
> >
> > From: phoenix <phoenix_@wp. pl>
> > Subject: [Vantage] Reading the database in VB .NET
> > To: vantage@yahoogroups .com
> > Date: Friday, July 25, 2008, 3:54 AM
> >
> >
> > I need to read some data from database using vb .net, can anyone
> > help with that?
>
> > The scenario is like following:
>
> > I am tracking the changes that user is doing on some checkboxes
> > within invoice entry. Each time when user is clicking this checkbox
> > a message box is displayed with possibility to accept or reject the
> > changes. All the above is done, now I need to: use a character field
> > to write there some data about time and userid, like
>
> > :01.01 Accepted John Doe
>
> > :01.05 Rejected John Doe
>
> > and this is also not a problem,
>
> > I know how to update a character field within the dataset,
> > But before applaying the changes I need to read the content of this
> > filed in database and then ADD my changes, ( DO NOT replace it.)
>
> >
> > Any help with code reading the context of database?
>
>
>
>
These are some you can use in 4GL code.



DCD-USERID

CUR-PLANT

CUR-COMP



Hope this helps.



Regards,

Stephen



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Robert Brown
Sent: 05 August 2008 17:36
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Reading the database in VB .NET



Grzegorz,

Nice work! That is some fine coding for someone who (in your origianl email) left the impression of being somewhat unfamiliar with .NET coding.

While you clearly took a different path than my example, it looks like a much stronger process as a result. (Glad my lengthy email was of any help.)

I'm new to BPM myself and would likely do you a disservice on how to detect the userID via 4GL. I would only recommended 2 things:

(1) Set up a full detail trace and then Open the invoice app (and do nothing else). Open the trace log and do a text find/search on your userID. I'd be shocked if that doesn't lead you to trace sections that invoked BO methods (that expose the userID) that you can trap via 4GL.

(2) "Ask Wonsil". Mark Wonsil (as well as several other regulars in the user group) are absolute whizzes at BPM/4GL.

Rob Brown

--- On Tue, 8/5/08, phoenix <phoenix_@... <mailto:phoenix_%40wp.pl> > wrote:

From: phoenix <phoenix_@... <mailto:phoenix_%40wp.pl> >
Subject: Re: [Vantage] Reading the database in VB .NET
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Date: Tuesday, August 5, 2008, 5:00 AM

Robert,
Thank you for your answer, it was very helpfull.
I have developed my own resolution, which basically force "save"
action, each time when user is clicking particular field. So my code is
like below:
(I am tracking changes to PayHold and InvoiceHeld)

BTW Do you know how can I obtain a session variables in 4GL - like
Session.UserID, Session.UserName?

*****c o d e*****

Private Sub APInvHed_AfterField Change(ByVal sender As object, ByVal args As DataColumnChangeEve ntArgs) Handles APInvHed_Column. ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldNam e]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Dim sUserIdent As String = APInvoiceForm. Session.UserID
Dim sNazwaUzyt As String = APInvoiceForm. Session.UserName
Dim sCzasData As String

If bZmiana = TRUE then
PayHold = Ctype(csm.GetNative ControlReference ("13285910- 6101-4aab- 9526-e8cd723b621 b"),EpiCheckBox)
InvoiceHeld = Ctype(csm.GetNative ControlReference ("e474fa10- 0be5-43b4- 9814-4a349805d1b f"),EpiCheckBox)
Select Case args.Column. ColumnName

Case "InvoiceHeld"
If InvoiceHeld. Checked = False then
If MessageBox.Show( "Czy akceptujesz tê faktury? ","Akceptacja faktury", MessageBoxButtons. OKCancel, _
Nothing, MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
'PayHold.Text = "Ze stanu zaznaczony wybra³e OK" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _
"Zaakceptowa³ e fakturê" & chr(13) & _
"numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
MessageBox.Show( InvoiceHeld. Text,"Faktura zaakceptowana" )
args.Row("Character 04") = args.Row("Character 04") & sUserIdent & ";" & sCzasData _
& ";" & "Akceptacja" & chr(13)
oTrans.Update( 1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13)& Now()
InvoiceHeld. Text = "Zrezygnowa³e z akceptacji faktury," & chr(13) & _
"faktura pozostaje nadal niezaakceptowana"
MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a z akceptacji")
args.Row("InvoiceHe ld")=TRUE
End If
Else
If MessageBox.Show( "Czy chcesz wstrzymaæ tê fakturê? ","Wstrzymanie faktury", MessageBoxButtons. OKCancel, _
Nothing, MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
'PayHold.Text = "Ze stanu odznaczony wybra³e OK" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _
"Wstrzyma³e fakturê" & chr(13) & _
"numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
MessageBox.Show( InvoiceHeld. Text,"Faktura wstrzymana")
args.Row("Character 04") = args.Row("Character 04") & sUserIdent & ";" & sCzasData _
& ";" & "Wstrzymanie" & chr(13)
oTrans.Update( 1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
InvoiceHeld. Text = "Zrezygnowa³e ze wstrzymania faktury," & chr(13) & _
"faktura pozostaje nadal zaakceptowana"
MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a ze wstrzymania" )
args.Row("InvoiceHe ld")=FALSE
End If
End if
bZmiana = TRUE

Case "PayHold"
If PayHold.Checked = False then
If MessageBox.Show( "Czy akceptujesz p³atnoæ dla tej faktury? ","Akceptacja p³atnoci", MessageBoxButtons. OKCancel, _
Nothing, MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
'PayHold.Text = "Ze stanu zaznaczony wybra³e OK" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
"Zaakceptowa³ e p³atnoæ dla faktury" & chr(13) & _
"numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
MessageBox.Show( PayHold.Text, "P³atnoæ zaakceptowana" )
args.Row("Character 03") = args.Row("Character 03") & sUserIdent & ";" & sCzasData _
& ";" & "Akceptacja" & chr(13)
oTrans.Update( 1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13)& Now()
PayHold.Text = "Zrezygnowa³e z akceptacji p³atnoci," & chr(13) & _
"p³atnoæ pozostaje nadal wstrzymana"
MessageBox.Show( PayHold.Text, "Rezeygnacja z akceptacji")
args.Row("PayHold" )=TRUE
End If
Else
If MessageBox.Show( "Czy chcesz wstrzymaæ p³atnoæ dla tej faktury? ","Wstrzymanie p³atnoci", MessageBoxButtons. OKCancel, _
Nothing, MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
'PayHold.Text = "Ze stanu odznaczony wybra³e OK" & chr(13) & _
'"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
sCzasData = Now()
PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
"Wstrzyma³e p³atnoæ dla faktury" & chr(13) & _
"numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
MessageBox.Show( PayHold.Text, "P³atnoæ wstrzymana")
args.Row("Character 03") = args.Row("Character 03") & sUserIdent & ";" & sCzasData _
& ";" & "Wstrzymanie" & chr(13)
oTrans.Update( 1)
Else
bZmiana = FALSE
'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _
'"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
'sUserIdent & chr(13) & Now()
PayHold.Text = "Zrezygnowa³e ze wstrzymania p³atnoci," & chr(13) & _
"p³atnoæ pozostaje nadal zaakceptowana"
MessageBox.Show( PayHold.Text, "Rezeygnacja ze wstrzymania" )
args.Row("PayHold" )=FALSE
End If
End if
bZmiana = TRUE
Case Else
End Select
End If 'bZmiana
End Sub

*****e n d o f c o d e*****

Grzegorz Szczepañski

Dnia Sat, 26 Jul 2008 09:51:50 -0700 (PDT)
Robert Brown <robertb_versa@ yahoo.com> napisał(a):

> I agree change log and auditing aren't perfect - but I've never seen
> them NOT work. I've just seen instances where the logging was set up
> against the wrong table.field.
>
> MUCH too easy to do as most apps have views that are redundant in
> many (field) aspects - as they serve different app purposes - and
> don't represent 'true' tables as defined in the data dictionary. If
> you enable full tracing & mimic the action(s) in the app you wish to
> capture activity history against, the 'true' table.field( s) being
> updated (that you wish to set up for change log tracking or auditing)
> will be revealed.
>
> Also, since (after re-reading your original post) it appears you are
> trying to capture not actual written to db changes - but also user
> actions creating a pending change that is then rejected and not
> written to the db - you have left yourself with a very challenging
> problem. (Why you want to track entered but rejected update actions
> is beyond me - but that is your problem to justify).
>
> Let's assume you've thoroughly done that though and you are still not
> getting what you want (eliminating the built in mechanisms as
> possible solutions).
>
> That is likely because you are attempting to capture pending changes
> that have a messagebox.show( "Y"/"N") (or 4GL equivalent) UI selection
> interrupt within the BO/method "Update" routine that either results
> in proceeding with or aborting the Update. Unless Tracing shows
> otherwise, that is likely a 'black box' compiled code UI
> object/method that offers no simple way to trap it and write the
> results to your custom log.
>
> You'll have to get devious in order to accomplish what you want (and,
> I warn you, the complexity of the customization will impact perceived
> application responsiveness) . Being an Invoice app, it hopefully won't
> be enough to thoroughly annoy users (as many Vantage BASE apps are
> already painfully slow) and impact their productivity.
>
> I assume you already already have Function code to capture the
> current userID (on application load) and the current system date/time
> every time an action you want to log occurs AND you've assigned them
> some simple aliases (Ex.,: "cUserID" containing the UserID value you
> captured on load and "cDateTime() " being a callable function to get
> the exact current date/time as needed)
>
> For every native checkbox control you wish to track, create a custom
> textbox linked to the same table/field. (Once you know your
> customization is working, make them not-visible and, for good
> measure, slide them off into a negative panel coordinate position -
> as even 'not visible' controls sometimes bleed through and appear on
> the screen - creating distractions to users.)
>
> Let's call these custom textboxes txtChk1, txtChk2, etc., for the
> example.
>
> Because they are linked to boolean fields, they will either contain
> null text values (if no Invoice record is loaded - a state equivalent
> to having no record loaded in the app: "row= -1"), "TRUE" (when the
> native checkbox is checked) or "FALSE" (when the native checkbox is
> unchecked).
>
> Now, use your wizard to set up the shell of Subs for each custom
> checkbox that will be triggered when _ChangedValue.
>
> At the module level, Dim a public text variable ("MyLog" for this
> example).
>
> Also set up the necessary Private WithEvents declaration of your
> dataview alias that contains the UD character field you are storing
> your change log data in. Don't forget to add the code to initialize
> it and enable read/write to it (and also destroy it when the app
> closes).
>
> Let's assign this dataview(field) - field being the specific UD
> character field holding your log record - an alias "MyLogViewVal" .
>
> Then, within each wizard generated Sub, add an If loop:
>
> If len(txtChk1. text) <> 0 Then
>
> End If
>
> This will prevent your code from generating errors when clearing the
> app of a record.
>
> It is within each of these If loops that you will then add your code
> to APPEND your change log record.
>
> If len(txtChk1. text) <> 0 Then
> 'Capture the current value of your change log record and start
> 'appending it.
> MyLog = (MyLogViewVal & " ; " & cUserID & " " & cDateTime()
> & _" txtChk1 value set to " & txtChk1.text)
>
> 'Now write back the appended info ONLY to the specific
> 'table.udCharfield record where you are storing the log
> '- NOT updating the entire table (or, worse yet, all tables in
> the 'app)!
>
> MyLogViewVal = MyLog
> ' You may or may not need this:
> otrans.update( MyLogViewVal)
>
> End If
>
> Doing this within every Sub triggered by your custom txtChk# control
> value changes will capture the interrum user changes BEFORE they are
> written to the db.
>
> The last step is to determine (via tracing) what business object
> adapter (& methods) are used to prompt the user to accept (& update
> the db) or reject (and return the value(s) to their original state).
>
> Use your wizard again to trap the adapter (probably after_method) and
> set up Cases that are invoked either after the user accepts the
> pending changes and updates the db or rejects them.
>
> Within those two cases, once again insert code similar to above:
>
> Case "someMethod"
> 'Whatever the method name is for Updating
> 'and a second Case method for rejection of changes
> MyLog = (MyLogViewVal & " ; Updated " & " " & cDateTime()
> & _" Updated ")
> ' replace " Updated " with something like " ChangeAborted "
> ' with the Case "someMethod" invoked for rejecting the change.
>
> MyLogViewVal = MyLog
> ' Again - You may or may not need this:
> otrans.update( MyLogViewVal)
>
>
> Not pretty - but it should work with proper code tweaks.
>
> My sympathies to you for whoever feels this is level of auditing is
> needed.
>
> (Good training and management can't be replaced by heavy handed "big
> brother is watching you" applications. )
>
> Rob Brown
>
>
>
>
> --- On Sat, 7/26/08, phoenix <phoenix_@wp. pl> wrote:
> From: phoenix <phoenix_@wp. pl>
> Subject: Re: [Vantage] Reading the database in VB .NET
> To: vantage@yahoogroups .com
> Date: Saturday, July 26, 2008, 3:30 AM
>
> Robert,
>
> Several people already prove that change log is not always working. So
> I decided to have my own change log on this particular fields
> toogether with two text boxes on separeate sheet that are showing the
> changes.
>
> I found that after the form is open I Just need a simple thing
> Row.args("NameofFie ld") = Row.args("NameofFie ld") & "text to be
> added"
>
> Now I Need to :
>
> 1. Find a way to refresh this text boxes each time the user is
> clicking on the tab of this sheet - any suggestions?
>
> 2. Find a way to force SAVE action, oTrans.Update is not working with
> some reasons. Maybe because I need to add some information witch view
> a want to save?
>
> Grzegorz Szczepański
>
> Dnia Fri, 25 Jul :59: (PDT)
> Robert Brown <robertb_versa@ yahoo.com> napisał(a):
>
> > Why not just utilize some combo of the built in change & audit
> > logging?
> >
> >
> > --- On Fri, 7/25/08, phoenix <phoenix_@wp. pl> wrote:
> >
> > From: phoenix <phoenix_@wp. pl>
> > Subject: [Vantage] Reading the database in VB .NET
> > To: vantage@yahoogroups .com
> > Date: Friday, July 25, 2008, 3:54 AM
> >
> >
> > I need to read some data from database using vb .net, can anyone
> > help with that?
>
> > The scenario is like following:
>
> > I am tracking the changes that user is doing on some checkboxes
> > within invoice entry. Each time when user is clicking this checkbox
> > a message box is displayed with possibility to accept or reject the
> > changes. All the above is done, now I need to: use a character field
> > to write there some data about time and userid, like
>
> > :01.01 Accepted John Doe
>
> > :01.05 Rejected John Doe
>
> > and this is also not a problem,
>
> > I know how to update a character field within the dataset,
> > But before applaying the changes I need to read the content of this
> > filed in database and then ADD my changes, ( DO NOT replace it.)
>
> >
> > Any help with code reading the context of database?
>
>
>
>







[Non-text portions of this message have been removed]
Robert,
your first impression was 100% right. I am new to vb.net, my code is a
result of some reading of vb.net book and googling the internet.

Grzegorz Szczepański

Dnia Tue, 5 Aug 2008 09:36:25 -0700 (PDT)
Robert Brown <robertb_versa@...> napisał(a):

> Grzegorz,
>
> Nice work! That is some fine coding for someone who (in your origianl
> email) left the impression of being somewhat unfamiliar with .NET
> coding.
>
> While you clearly took a different path than my example, it looks
> like a much stronger process as a result. (Glad my lengthy email was
> of any help.)
>
> I'm new to BPM myself and would likely do you a disservice on how to
> detect the userID via 4GL. I would only recommended 2 things:
>
> (1) Set up a full detail trace and then Open the invoice app (and do
> nothing else). Open the trace log and do a text find/search on your
> userID. I'd be shocked if that doesn't lead you to trace sections
> that invoked BO methods (that expose the userID) that you can trap
> via 4GL.
>
> (2) "Ask Wonsil". Mark Wonsil (as well as several other regulars in
> the user group) are absolute whizzes at BPM/4GL.
>
> Rob Brown
>
> --- On Tue, 8/5/08, phoenix <phoenix_@...> wrote:
>
> From: phoenix <phoenix_@...>
> Subject: Re: [Vantage] Reading the database in VB .NET
> To: vantage@yahoogroups.com
> Date: Tuesday, August 5, 2008, 5:00 AM
>
>
>
>
>
>
> Robert,
> Thank you for your answer, it was very helpfull.
> I have developed my own resolution, which basically force "save"
> action, each time when user is clicking particular field. So my code
> is like below:
> (I am tracking changes to PayHold and InvoiceHeld)
>
> BTW Do you know how can I obtain a session variables in 4GL - like
> Session.UserID, Session.UserName?
>
> *****c o d e*****
>
> Private Sub APInvHed_AfterField Change(ByVal sender As object, ByVal
> args As DataColumnChangeEve ntArgs) Handles APInvHed_Column.
> ColumnChanged '// ** Argument Properties and Uses ** '//
> args.Row("[FieldNam e]") '// args.Column, args.ProposedValue, args.Row
> '
> 'Add Event Handler Code
> '
> Dim sUserIdent As String = APInvoiceForm. Session.UserID
> Dim sNazwaUzyt As String = APInvoiceForm. Session.UserName
> Dim sCzasData As String
>
> If bZmiana = TRUE then
> PayHold = Ctype(csm.GetNative ControlReference ("13285910- 6101-4aab-
> 9526-e8cd723b621 b"),EpiCheckBox) InvoiceHeld = Ctype(csm.GetNative
> ControlReference ("e474fa10- 0be5-43b4- 9814-4a349805d1b
> f"),EpiCheckBox) Select Case args.Column. ColumnName
>
> Case "InvoiceHeld"
> If InvoiceHeld. Checked = False then
> If MessageBox.Show( "Czy akceptujesz tê faktury? ","Akceptacja
> faktury", MessageBoxButtons. OKCancel, _ Nothing, MessageBoxDefaultBu
> tton.Button1) = DialogResult. OK Then 'PayHold.Text = "Ze stanu
> zaznaczony wybra³e OK" & chr(13) & _ '"Teraz przycisk powinien byæ
> odznaczony" & chr(13) & _ 'sUserIdent & chr(13) & Now()
> sCzasData = Now()
> InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _
> "Zaakceptowa³ e fakturê" & chr(13) & _
> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
> MessageBox.Show( InvoiceHeld. Text,"Faktura zaakceptowana" )
> args.Row("Character 04") = args.Row("Character 04") & sUserIdent &
> ";" & sCzasData _ & ";" & "Akceptacja" & chr(13)
> oTrans.Update( 1)
> Else
> bZmiana = FALSE
> 'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _
> '"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
> 'sUserIdent & chr(13)& Now()
> InvoiceHeld. Text = "Zrezygnowa³e z akceptacji faktury," & chr(13) & _
> "faktura pozostaje nadal niezaakceptowana"
> MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a z akceptacji")
> args.Row("InvoiceHe ld")=TRUE
> End If
> Else
> If MessageBox.Show( "Czy chcesz wstrzymaæ tê fakturê? ","Wstrzymanie
> faktury", MessageBoxButtons. OKCancel, _ Nothing, MessageBoxDefaultBu
> tton.Button1) = DialogResult. OK Then 'PayHold.Text = "Ze stanu
> odznaczony wybra³e OK" & chr(13) & _ '"Teraz przycisk powinien byæ
> zaznaczony" & chr(13) & _ 'sUserIdent & chr(13) & Now()
> sCzasData = Now()
> InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _
> "Wstrzyma³e fakturê" & chr(13) & _
> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
> MessageBox.Show( InvoiceHeld. Text,"Faktura wstrzymana")
> args.Row("Character 04") = args.Row("Character 04") & sUserIdent &
> ";" & sCzasData _ & ";" & "Wstrzymanie" & chr(13)
> oTrans.Update( 1)
> Else
> bZmiana = FALSE
> 'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _
> '"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
> 'sUserIdent & chr(13) & Now()
> InvoiceHeld. Text = "Zrezygnowa³e ze wstrzymania faktury," & chr(13)
> & _ "faktura pozostaje nadal zaakceptowana"
> MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a ze wstrzymania" )
> args.Row("InvoiceHe ld")=FALSE
> End If
> End if
> bZmiana = TRUE
>
> Case "PayHold"
> If PayHold.Checked = False then
> If MessageBox.Show( "Czy akceptujesz p³atnoæ dla tej faktury?
> ","Akceptacja p³atnoci", MessageBoxButtons. OKCancel, _ Nothing,
> MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
> 'PayHold.Text = "Ze stanu zaznaczony wybra³e OK" & chr(13) & _
> '"Teraz przycisk powinien byæ odznaczony" & chr(13) & _ 'sUserIdent &
> chr(13) & Now() sCzasData = Now()
> PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
> "Zaakceptowa³ e p³atnoæ dla faktury" & chr(13) & _
> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
> MessageBox.Show( PayHold.Text, "P³atnoæ zaakceptowana" )
> args.Row("Character 03") = args.Row("Character 03") & sUserIdent &
> ";" & sCzasData _ & ";" & "Akceptacja" & chr(13)
> oTrans.Update( 1)
> Else
> bZmiana = FALSE
> 'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _
> '"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _
> 'sUserIdent & chr(13)& Now()
> PayHold.Text = "Zrezygnowa³e z akceptacji p³atnoci," & chr(13) & _
> "p³atnoæ pozostaje nadal wstrzymana"
> MessageBox.Show( PayHold.Text, "Rezeygnacja z akceptacji")
> args.Row("PayHold" )=TRUE
> End If
> Else
> If MessageBox.Show( "Czy chcesz wstrzymaæ p³atnoæ dla tej faktury?
> ","Wstrzymanie p³atnoci", MessageBoxButtons. OKCancel, _ Nothing,
> MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then
> 'PayHold.Text = "Ze stanu odznaczony wybra³e OK" & chr(13) & _
> '"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _ 'sUserIdent &
> chr(13) & Now() sCzasData = Now()
> PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _
> "Wstrzyma³e p³atnoæ dla faktury" & chr(13) & _
> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData
> MessageBox.Show( PayHold.Text, "P³atnoæ wstrzymana")
> args.Row("Character 03") = args.Row("Character 03") & sUserIdent &
> ";" & sCzasData _ & ";" & "Wstrzymanie" & chr(13)
> oTrans.Update( 1)
> Else
> bZmiana = FALSE
> 'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _
> '"Teraz przycisk powinien byæ odznaczony" & chr(13) & _
> 'sUserIdent & chr(13) & Now()
> PayHold.Text = "Zrezygnowa³e ze wstrzymania p³atnoci," & chr(13) & _
> "p³atnoæ pozostaje nadal zaakceptowana"
> MessageBox.Show( PayHold.Text, "Rezeygnacja ze wstrzymania" )
> args.Row("PayHold" )=FALSE
> End If
> End if
> bZmiana = TRUE
> Case Else
> End Select
> End If 'bZmiana
> End Sub
>
> *****e n d o f c o d e*****
>
> Grzegorz Szczepañski
>
> Dnia Sat, 26 Jul 2008 09:51:50 -0700 (PDT)
> Robert Brown <robertb_versa@ yahoo.com> napisał(a):
>
> > I agree change log and auditing aren't perfect - but I've never seen
> > them NOT work. I've just seen instances where the logging was set up
> > against the wrong table.field.
> >
> > MUCH too easy to do as most apps have views that are redundant in
> > many (field) aspects - as they serve different app purposes - and
> > don't represent 'true' tables as defined in the data dictionary. If
> > you enable full tracing & mimic the action(s) in the app you wish to
> > capture activity history against, the 'true' table.field( s) being
> > updated (that you wish to set up for change log tracking or
> > auditing) will be revealed.
> >
> > Also, since (after re-reading your original post) it appears you are
> > trying to capture not actual written to db changes - but also user
> > actions creating a pending change that is then rejected and not
> > written to the db - you have left yourself with a very challenging
> > problem. (Why you want to track entered but rejected update actions
> > is beyond me - but that is your problem to justify).
> >
> > Let's assume you've thoroughly done that though and you are still
> > not getting what you want (eliminating the built in mechanisms as
> > possible solutions).
> >
> > That is likely because you are attempting to capture pending changes
> > that have a messagebox.show( "Y"/"N") (or 4GL equivalent) UI
> > selection interrupt within the BO/method "Update" routine that
> > either results in proceeding with or aborting the Update. Unless
> > Tracing shows otherwise, that is likely a 'black box' compiled code
> > UI object/method that offers no simple way to trap it and write the
> > results to your custom log.
> >
> > You'll have to get devious in order to accomplish what you want
> > (and, I warn you, the complexity of the customization will impact
> > perceived application responsiveness) . Being an Invoice app, it
> > hopefully won't be enough to thoroughly annoy users (as many
> > Vantage BASE apps are already painfully slow) and impact their
> > productivity.
> >
> > I assume you already already have Function code to capture the
> > current userID (on application load) and the current system
> > date/time every time an action you want to log occurs AND you've
> > assigned them some simple aliases (Ex.,: "cUserID" containing the
> > UserID value you captured on load and "cDateTime() " being a
> > callable function to get the exact current date/time as needed)
> >
> > For every native checkbox control you wish to track, create a custom
> > textbox linked to the same table/field. (Once you know your
> > customization is working, make them not-visible and, for good
> > measure, slide them off into a negative panel coordinate position -
> > as even 'not visible' controls sometimes bleed through and appear on
> > the screen - creating distractions to users.)
> >
> > Let's call these custom textboxes txtChk1, txtChk2, etc., for the
> > example.
> >
> > Because they are linked to boolean fields, they will either contain
> > null text values (if no Invoice record is loaded - a state
> > equivalent to having no record loaded in the app: "row= -1"),
> > "TRUE" (when the native checkbox is checked) or "FALSE" (when the
> > native checkbox is unchecked).
> >
> > Now, use your wizard to set up the shell of Subs for each custom
> > checkbox that will be triggered when _ChangedValue.
> >
> > At the module level, Dim a public text variable ("MyLog" for this
> > example).
> >
> > Also set up the necessary Private WithEvents declaration of your
> > dataview alias that contains the UD character field you are storing
> > your change log data in. Don't forget to add the code to initialize
> > it and enable read/write to it (and also destroy it when the app
> > closes).
> >
> > Let's assign this dataview(field) - field being the specific UD
> > character field holding your log record - an alias "MyLogViewVal" .
> >
> > Then, within each wizard generated Sub, add an If loop:
> >
> > If len(txtChk1. text) <> 0 Then
> >
> > End If
> >
> > This will prevent your code from generating errors when clearing the
> > app of a record.
> >
> > It is within each of these If loops that you will then add your code
> > to APPEND your change log record.
> >
> > If len(txtChk1. text) <> 0 Then
> > 'Capture the current value of your change log record and start
> > 'appending it.
> > MyLog = (MyLogViewVal & " ; " & cUserID & " " & cDateTime()
> > & _" txtChk1 value set to " & txtChk1.text)
> >
> > 'Now write back the appended info ONLY to the specific
> > 'table.udCharfield record where you are storing the log
> > '- NOT updating the entire table (or, worse yet, all tables in
> > the 'app)!
> >
> > MyLogViewVal = MyLog
> > ' You may or may not need this:
> > otrans.update( MyLogViewVal)
> >
> > End If
> >
> > Doing this within every Sub triggered by your custom txtChk# control
> > value changes will capture the interrum user changes BEFORE they are
> > written to the db.
> >
> > The last step is to determine (via tracing) what business object
> > adapter (& methods) are used to prompt the user to accept (& update
> > the db) or reject (and return the value(s) to their original state).
> >
> > Use your wizard again to trap the adapter (probably after_method)
> > and set up Cases that are invoked either after the user accepts the
> > pending changes and updates the db or rejects them.
> >
> > Within those two cases, once again insert code similar to above:
> >
> > Case "someMethod"
> > 'Whatever the method name is for Updating
> > 'and a second Case method for rejection of changes
> > MyLog = (MyLogViewVal & " ; Updated " & " " & cDateTime()
> > & _" Updated ")
> > ' replace " Updated " with something like " ChangeAborted "
> > ' with the Case "someMethod" invoked for rejecting the change.
> >
> > MyLogViewVal = MyLog
> > ' Again - You may or may not need this:
> > otrans.update( MyLogViewVal)
> >
> >
> > Not pretty - but it should work with proper code tweaks.
> >
> > My sympathies to you for whoever feels this is level of auditing is
> > needed.
> >
> > (Good training and management can't be replaced by heavy handed "big
> > brother is watching you" applications. )
> >
> > Rob Brown
> >
> >
> >
> >
> > --- On Sat, 7/26/08, phoenix <phoenix_@wp. pl> wrote:
> > From: phoenix <phoenix_@wp. pl>
> > Subject: Re: [Vantage] Reading the database in VB .NET
> > To: vantage@yahoogroups .com
> > Date: Saturday, July 26, 2008, 3:30 AM
> >
> > Robert,
> >
> > Several people already prove that change log is not always working.
> > So I decided to have my own change log on this particular fields
> > toogether with two text boxes on separeate sheet that are showing
> > the changes.
> >
> > I found that after the form is open I Just need a simple thing
> > Row.args("NameofFie ld") = Row.args("NameofFie ld") & "text to be
> > added"
> >
> > Now I Need to :
> >
> > 1. Find a way to refresh this text boxes each time the user is
> > clicking on the tab of this sheet - any suggestions?
> >
> > 2. Find a way to force SAVE action, oTrans.Update is not working
> > with some reasons. Maybe because I need to add some information
> > witch view a want to save?
> >
> > Grzegorz Szczepański
> >
> > Dnia Fri, 25 Jul :59: (PDT)
> > Robert Brown <robertb_versa@ yahoo.com> napisał(a):
> >
> > > Why not just utilize some combo of the built in change & audit
> > > logging?
> > >
> > >
> > > --- On Fri, 7/25/08, phoenix <phoenix_@wp. pl> wrote:
> > >
> > > From: phoenix <phoenix_@wp. pl>
> > > Subject: [Vantage] Reading the database in VB .NET
> > > To: vantage@yahoogroups .com
> > > Date: Friday, July 25, 2008, 3:54 AM
> > >
> > >
> > > I need to read some data from database using vb .net, can anyone
> > > help with that?
> >
> > > The scenario is like following:
> >
> > > I am tracking the changes that user is doing on some checkboxes
> > > within invoice entry. Each time when user is clicking this
> > > checkbox a message box is displayed with possibility to accept or
> > > reject the changes. All the above is done, now I need to: use a
> > > character field to write there some data about time and userid,
> > > like
> >
> > > :01.01 Accepted John Doe
> >
> > > :01.05 Rejected John Doe
> >
> > > and this is also not a problem,
> >
> > > I know how to update a character field within the dataset,
> > > But before applaying the changes I need to read the content of
> > > this filed in database and then ADD my changes, ( DO NOT replace
> > > it.)
> >
> > >
> > > Any help with code reading the context of database?
> >
> >
> >
> >
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
My motto is, "why write (from scratch) what you can borrow" & adapt.
I use every free legal source I can lay my hands on for code examples.
Rob

--- On Tue, 8/5/08, phoenix <phoenix_@...> wrote:
From: phoenix <phoenix_@...>
Subject: Re: [Vantage] Reading the database in VB .NET
To: vantage@yahoogroups.com
Date: Tuesday, August 5, 2008, 5:42 PM











Robert,

your first impression was 100% right. I am new to vb.net, my code is a

result of some reading of vb.net book and googling the internet.



Grzegorz Szczepański



Dnia Tue, 5 Aug :36: (PDT)

Robert Brown <robertb_versa@ yahoo.com> napisał(a):



> Grzegorz,

>

> Nice work! That is some fine coding for someone who (in your origianl

> email) left the impression of being somewhat unfamiliar with .NET

> coding.

>

> While you clearly took a different path than my example, it looks

> like a much stronger process as a result. (Glad my lengthy email was

> of any help.)

>

> I'm new to BPM myself and would likely do you a disservice on how to

> detect the userID via 4GL. I would only recommended 2 things:

>

> (1) Set up a full detail trace and then Open the invoice app (and do

> nothing else). Open the trace log and do a text find/search on your

> userID. I'd be shocked if that doesn't lead you to trace sections

> that invoked BO methods (that expose the userID) that you can trap

> via 4GL.

>

> (2) "Ask Wonsil". Mark Wonsil (as well as several other regulars in

> the user group) are absolute whizzes at BPM/4GL.

>

> Rob Brown

>

> --- On Tue, 8/5/08, phoenix <phoenix_@wp. pl> wrote:

>

> From: phoenix <phoenix_@wp. pl>

> Subject: Re: [Vantage] Reading the database in VB .NET

> To: vantage@yahoogroups .com

> Date: Tuesday, August 5, 2008, 5:00 AM

>

>

>

>

>

>

> Robert,

> Thank you for your answer, it was very helpfull.

> I have developed my own resolution, which basically force "save"

> action, each time when user is clicking particular field. So my code

> is like below:

> (I am tracking changes to PayHold and InvoiceHeld)

>

> BTW Do you know how can I obtain a session variables in 4GL - like

> Session.UserID, Session.UserName?

>

> *****c o d e*****

>

> Private Sub APInvHed_AfterField Change(ByVal sender As object, ByVal

> args As DataColumnChangeEve ntArgs) Handles APInvHed_Column.

> ColumnChanged '// ** Argument Properties and Uses ** '//

> args.Row("[FieldNam e]") '// args.Column, args.ProposedValue, args.Row

> '

> 'Add Event Handler Code

> '

> Dim sUserIdent As String = APInvoiceForm. Session.UserID

> Dim sNazwaUzyt As String = APInvoiceForm. Session.UserName

> Dim sCzasData As String

>

> If bZmiana = TRUE then

> PayHold = Ctype(csm.GetNative ControlReference ("- 6101-4aab-

> 9526-e8cd723b621 b"),EpiCheckBox) InvoiceHeld = Ctype(csm.GetNative

> ControlReference ("e474fa10- 0be5-43b4- 9814-4a349805d1b

> f"),EpiCheckBox) Select Case args.Column. ColumnName

>

> Case "InvoiceHeld"

> If InvoiceHeld. Checked = False then

> If MessageBox.Show( "Czy akceptujesz tê faktury? ","Akceptacja

> faktury", MessageBoxButtons. OKCancel, _ Nothing, MessageBoxDefaultBu

> tton.Button1) = DialogResult. OK Then 'PayHold.Text = "Ze stanu

> zaznaczony wybra³e OK" & chr(13) & _ '"Teraz przycisk powinien byæ

> odznaczony" & chr(13) & _ 'sUserIdent & chr(13) & Now()

> sCzasData = Now()

> InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _

> "Zaakceptowa³ e fakturê" & chr(13) & _

> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData

> MessageBox.Show( InvoiceHeld. Text,"Faktura zaakceptowana" )

> args.Row("Character 04") = args.Row("Character 04") & sUserIdent &

> ";" & sCzasData _ & ";" & "Akceptacja" & chr(13)

> oTrans.Update( 1)

> Else

> bZmiana = FALSE

> 'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _

> '"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _

> 'sUserIdent & chr(13)& Now()

> InvoiceHeld. Text = "Zrezygnowa³e z akceptacji faktury," & chr(13) & _

> "faktura pozostaje nadal niezaakceptowana"

> MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a z akceptacji")

> args.Row("InvoiceHe ld")=TRUE

> End If

> Else

> If MessageBox.Show( "Czy chcesz wstrzymaæ tê fakturê? ","Wstrzymanie

> faktury", MessageBoxButtons. OKCancel, _ Nothing, MessageBoxDefaultBu

> tton.Button1) = DialogResult. OK Then 'PayHold.Text = "Ze stanu

> odznaczony wybra³e OK" & chr(13) & _ '"Teraz przycisk powinien byæ

> zaznaczony" & chr(13) & _ 'sUserIdent & chr(13) & Now()

> sCzasData = Now()

> InvoiceHeld. Text = sNazwaUzyt & chr(13) & chr(13) & _

> "Wstrzyma³e fakturê" & chr(13) & _

> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData

> MessageBox.Show( InvoiceHeld. Text,"Faktura wstrzymana")

> args.Row("Character 04") = args.Row("Character 04") & sUserIdent &

> ";" & sCzasData _ & ";" & "Wstrzymanie" & chr(13)

> oTrans.Update( 1)

> Else

> bZmiana = FALSE

> 'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _

> '"Teraz przycisk powinien byæ odznaczony" & chr(13) & _

> 'sUserIdent & chr(13) & Now()

> InvoiceHeld. Text = "Zrezygnowa³e ze wstrzymania faktury," & chr(13)

> & _ "faktura pozostaje nadal zaakceptowana"

> MessageBox.Show( InvoiceHeld. Text,"Rezeygnacj a ze wstrzymania" )

> args.Row("InvoiceHe ld")=FALSE

> End If

> End if

> bZmiana = TRUE

>

> Case "PayHold"

> If PayHold.Checked = False then

> If MessageBox.Show( "Czy akceptujesz p³atnoæ dla tej faktury?

> ","Akceptacja p³atnoci", MessageBoxButtons. OKCancel, _ Nothing,

> MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then

> 'PayHold.Text = "Ze stanu zaznaczony wybra³e OK" & chr(13) & _

> '"Teraz przycisk powinien byæ odznaczony" & chr(13) & _ 'sUserIdent &

> chr(13) & Now() sCzasData = Now()

> PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _

> "Zaakceptowa³ e p³atnoæ dla faktury" & chr(13) & _

> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData

> MessageBox.Show( PayHold.Text, "P³atnoæ zaakceptowana" )

> args.Row("Character 03") = args.Row("Character 03") & sUserIdent &

> ";" & sCzasData _ & ";" & "Akceptacja" & chr(13)

> oTrans.Update( 1)

> Else

> bZmiana = FALSE

> 'PayHold.Text = "Ze stanu zaznaczony wybra³e Anuluj" & chr(13) & _

> '"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _

> 'sUserIdent & chr(13)& Now()

> PayHold.Text = "Zrezygnowa³e z akceptacji p³atnoci," & chr(13) & _

> "p³atnoæ pozostaje nadal wstrzymana"

> MessageBox.Show( PayHold.Text, "Rezeygnacja z akceptacji")

> args.Row("PayHold" )=TRUE

> End If

> Else

> If MessageBox.Show( "Czy chcesz wstrzymaæ p³atnoæ dla tej faktury?

> ","Wstrzymanie p³atnoci", MessageBoxButtons. OKCancel, _ Nothing,

> MessageBoxDefaultBu tton.Button1) = DialogResult. OK Then

> 'PayHold.Text = "Ze stanu odznaczony wybra³e OK" & chr(13) & _

> '"Teraz przycisk powinien byæ zaznaczony" & chr(13) & _ 'sUserIdent &

> chr(13) & Now() sCzasData = Now()

> PayHold.Text = sNazwaUzyt & chr(13) & chr(13) & _

> "Wstrzyma³e p³atnoæ dla faktury" & chr(13) & _

> "numer: " & args.Row("InvoiceNu m") & chr(13) & chr(13) & sCzasData

> MessageBox.Show( PayHold.Text, "P³atnoæ wstrzymana")

> args.Row("Character 03") = args.Row("Character 03") & sUserIdent &

> ";" & sCzasData _ & ";" & "Wstrzymanie" & chr(13)

> oTrans.Update( 1)

> Else

> bZmiana = FALSE

> 'PayHold.Text = "Ze stanu odznaczony wybra³e Anuluj" & chr(13) & _

> '"Teraz przycisk powinien byæ odznaczony" & chr(13) & _

> 'sUserIdent & chr(13) & Now()

> PayHold.Text = "Zrezygnowa³e ze wstrzymania p³atnoci," & chr(13) & _

> "p³atnoæ pozostaje nadal zaakceptowana"

> MessageBox.Show( PayHold.Text, "Rezeygnacja ze wstrzymania" )

> args.Row("PayHold" )=FALSE

> End If

> End if

> bZmiana = TRUE

> Case Else

> End Select

> End If 'bZmiana

> End Sub

>

> *****e n d o f c o d e*****

>

> Grzegorz Szczepañski

>

> Dnia Sat, 26 Jul :51: (PDT)

> Robert Brown <robertb_versa@ yahoo.com> napisał(a):

>

> > I agree change log and auditing aren't perfect - but I've never seen

> > them NOT work. I've just seen instances where the logging was set up

> > against the wrong table.field.

> >

> > MUCH too easy to do as most apps have views that are redundant in

> > many (field) aspects - as they serve different app purposes - and

> > don't represent 'true' tables as defined in the data dictionary. If

> > you enable full tracing & mimic the action(s) in the app you wish to

> > capture activity history against, the 'true' table.field( s) being

> > updated (that you wish to set up for change log tracking or

> > auditing) will be revealed.

> >

> > Also, since (after re-reading your original post) it appears you are

> > trying to capture not actual written to db changes - but also user

> > actions creating a pending change that is then rejected and not

> > written to the db - you have left yourself with a very challenging

> > problem. (Why you want to track entered but rejected update actions

> > is beyond me - but that is your problem to justify).

> >

> > Let's assume you've thoroughly done that though and you are still

> > not getting what you want (eliminating the built in mechanisms as

> > possible solutions).

> >

> > That is likely because you are attempting to capture pending changes

> > that have a messagebox.show( "Y"/"N") (or 4GL equivalent) UI

> > selection interrupt within the BO/method "Update" routine that

> > either results in proceeding with or aborting the Update. Unless

> > Tracing shows otherwise, that is likely a 'black box' compiled code

> > UI object/method that offers no simple way to trap it and write the

> > results to your custom log.

> >

> > You'll have to get devious in order to accomplish what you want

> > (and, I warn you, the complexity of the customization will impact

> > perceived application responsiveness) . Being an Invoice app, it

> > hopefully won't be enough to thoroughly annoy users (as many

> > Vantage BASE apps are already painfully slow) and impact their

> > productivity.

> >

> > I assume you already already have Function code to capture the

> > current userID (on application load) and the current system

> > date/time every time an action you want to log occurs AND you've

> > assigned them some simple aliases (Ex.,: "cUserID" containing the

> > UserID value you captured on load and "cDateTime() " being a

> > callable function to get the exact current date/time as needed)

> >

> > For every native checkbox control you wish to track, create a custom

> > textbox linked to the same table/field. (Once you know your

> > customization is working, make them not-visible and, for good

> > measure, slide them off into a negative panel coordinate position -

> > as even 'not visible' controls sometimes bleed through and appear on

> > the screen - creating distractions to users.)

> >

> > Let's call these custom textboxes txtChk1, txtChk2, etc., for the

> > example.

> >

> > Because they are linked to boolean fields, they will either contain

> > null text values (if no Invoice record is loaded - a state

> > equivalent to having no record loaded in the app: "row= -1"),

> > "TRUE" (when the native checkbox is checked) or "FALSE" (when the

> > native checkbox is unchecked).

> >

> > Now, use your wizard to set up the shell of Subs for each custom

> > checkbox that will be triggered when _ChangedValue.

> >

> > At the module level, Dim a public text variable ("MyLog" for this

> > example).

> >

> > Also set up the necessary Private WithEvents declaration of your

> > dataview alias that contains the UD character field you are storing

> > your change log data in. Don't forget to add the code to initialize

> > it and enable read/write to it (and also destroy it when the app

> > closes).

> >

> > Let's assign this dataview(field) - field being the specific UD

> > character field holding your log record - an alias "MyLogViewVal" .

> >

> > Then, within each wizard generated Sub, add an If loop:

> >

> > If len(txtChk1. text) <> 0 Then

> >

> > End If

> >

> > This will prevent your code from generating errors when clearing the

> > app of a record.

> >

> > It is within each of these If loops that you will then add your code

> > to APPEND your change log record.

> >

> > If len(txtChk1. text) <> 0 Then

> > 'Capture the current value of your change log record and start

> > 'appending it.

> > MyLog = (MyLogViewVal & " ; " & cUserID & " " & cDateTime()

> > & _" txtChk1 value set to " & txtChk1.text)

> >

> > 'Now write back the appended info ONLY to the specific

> > 'table.udCharfield record where you are storing the log

> > '- NOT updating the entire table (or, worse yet, all tables in

> > the 'app)!

> >

> > MyLogViewVal = MyLog

> > ' You may or may not need this:

> > otrans.update( MyLogViewVal)

> >

> > End If

> >

> > Doing this within every Sub triggered by your custom txtChk# control

> > value changes will capture the interrum user changes BEFORE they are

> > written to the db.

> >

> > The last step is to determine (via tracing) what business object

> > adapter (& methods) are used to prompt the user to accept (& update

> > the db) or reject (and return the value(s) to their original state).

> >

> > Use your wizard again to trap the adapter (probably after_method)

> > and set up Cases that are invoked either after the user accepts the

> > pending changes and updates the db or rejects them.

> >

> > Within those two cases, once again insert code similar to above:

> >

> > Case "someMethod"

> > 'Whatever the method name is for Updating

> > 'and a second Case method for rejection of changes

> > MyLog = (MyLogViewVal & " ; Updated " & " " & cDateTime()

> > & _" Updated ")

> > ' replace " Updated " with something like " ChangeAborted "

> > ' with the Case "someMethod" invoked for rejecting the change.

> >

> > MyLogViewVal = MyLog

> > ' Again - You may or may not need this:

> > otrans.update( MyLogViewVal)

> >

> >

> > Not pretty - but it should work with proper code tweaks.

> >

> > My sympathies to you for whoever feels this is level of auditing is

> > needed.

> >

> > (Good training and management can't be replaced by heavy handed "big

> > brother is watching you" applications. )

> >

> > Rob Brown

> >

> >

> >

> >

> > --- On Sat, 7/26/08, phoenix <phoenix_@wp. pl> wrote:

> > From: phoenix <phoenix_@wp. pl>

> > Subject: Re: [Vantage] Reading the database in VB .NET

> > To: vantage@yahoogroups .com

> > Date: Saturday, July 26, 2008, 3:30 AM

> >

> > Robert,

> >

> > Several people already prove that change log is not always working.

> > So I decided to have my own change log on this particular fields

> > toogether with two text boxes on separeate sheet that are showing

> > the changes.

> >

> > I found that after the form is open I Just need a simple thing

> > Row.args("NameofFie ld") = Row.args("NameofFie ld") & "text to be

> > added"

> >

> > Now I Need to :

> >

> > 1. Find a way to refresh this text boxes each time the user is

> > clicking on the tab of this sheet - any suggestions?

> >

> > 2. Find a way to force SAVE action, oTrans.Update is not working

> > with some reasons. Maybe because I need to add some information

> > witch view a want to save?

> >

> > Grzegorz Szczepański

> >

> > Dnia Fri, 25 Jul :59: (PDT)

> > Robert Brown <robertb_versa@ yahoo.com> napisał(a):

> >

> > > Why not just utilize some combo of the built in change & audit

> > > logging?

> > >

> > >

> > > --- On Fri, 7/25/08, phoenix <phoenix_@wp. pl> wrote:

> > >

> > > From: phoenix <phoenix_@wp. pl>

> > > Subject: [Vantage] Reading the database in VB .NET

> > > To: vantage@yahoogroups .com

> > > Date: Friday, July 25, 2008, 3:54 AM

> > >

> > >

> > > I need to read some data from database using vb .net, can anyone

> > > help with that?

> >

> > > The scenario is like following:

> >

> > > I am tracking the changes that user is doing on some checkboxes

> > > within invoice entry. Each time when user is clicking this

> > > checkbox a message box is displayed with possibility to accept or

> > > reject the changes. All the above is done, now I need to: use a

> > > character field to write there some data about time and userid,

> > > like

> >

> > > :01.01 Accepted John Doe

> >

> > > :01.05 Rejected John Doe

> >

> > > and this is also not a problem,

> >

> > > I know how to update a character field within the dataset,

> > > But before applaying the changes I need to read the content of

> > > this filed in database and then ADD my changes, ( DO NOT replace

> > > it.)

> >

> > >

> > > Any help with code reading the context of database?

> >

> >

> >

> >

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>