infor.com
concierge
infor u
developer portal
Home
Groups
VISUAL - Enterprise Customer Community
global variables in macros?
Legacy Contributor
Is there currently a way to pass a variable from one event (ex OnLoad) to another (ex OnSave) ?
Basically what I'm trying to do is do a check to see if a specific field has been changed from what was originally loaded. If not would anyone know of a way of doing this?
Infor OS - Presentation for user groups-20200707 0935-1.mp4
Find more posts tagged with
Comments
Legacy Contributor
You could write the value to a flatfile on load, then read and compare it on save. That would get messy if you use VISUAL on Terminal Services or Citrix though.
Legacy Contributor
I wish there was a simplar solution but what I ended up doing is on the OnSaveOP I contacted the live db then saved it to a variable(s), then checked the text boxes current value to see if there was any change...
Dim objCN, strConnection
Set objCN = CreateObject("ADODB.Connection")
objCN.ConnectionString = "Provider=SQLOLEDB;Data Source=nemsql01;Trusted_Connection=Yes;Initial Catalog=sandbox1;User ID=;Password=;"
objCN.Open
Dim strSQLQuery
strSQLQuery = "SELECT RUN, SETUP_HRS, RESOURCE_ID FROM dbo.OPERATION WHERE (WORKORDER_TYPE = 'w') AND (WORKORDER_BASE_ID = '" & WORKORDER_BASE_ID & "') AND (WORKORDER_LOT_ID = '" & WORKORDER_LOT_ID & "') AND (WORKORDER_SPLIT_ID = '" & WORKORDER_SPLIT_ID & "') AND (WORKORDER_SUB_ID = '" & WORKORDER_SUB_ID & "') AND (SEQUENCE_NO = " & SEQUENCE_NO & ")"
Dim objRS
Set objRS = CreateObject("ADODB.Recordset")
Set objRS = objCN.Execute(strSQLQuery)
Dim strRun
Dim strSetup
Dim strResource
Do Until objRS.EOF
strRun = objRS.Fields("RUN")
strSetup = objRS.Fields("SETUP_HRS")
strResource = objRS.Fields("RESOURCE_ID")
objRS.MoveNext
Loop
objRS.Close
objCN.Close
If CDbl(SETUP_HRS) <> CDbl(strSetup) Or CDbl(RUN) <> CDbl(strRun) Then
Set objSysInfo = CreateObject("ADSystemInfo")
Set objCurrentUser = GetObject("LDAP://" & objSysInfo.UserName)
Dim strName
strName = objCurrentUser.givenName & " " & objcurrentuser.lastname
Dim objCNUpdate
Set objCNUpdate = CreateObject("ADODB.Connection")
objCNUpdate.ConnectionString = "Provider=SQLOLEDB;Data Source=nemsql01;Trusted_Connection=Yes;Initial Catalog=SP000X;User ID=;Password=;"
objCNUpdate.Open
Dim strSQLQueryUpdate
strSQLQueryUpdate = "INSERT INTO operationupdate(WORKORDER_TYPE, WORKORDER_BASE_ID, WORKORDER_LOT_ID, WORKORDER_SPLIT_ID, WORKORDER_SUB_ID, SEQUENCE_NO, new_RESOURCE_ID, new_SETUP_HRS, new_RUN, old_RESOURCE_ID, old_SETUP_HRS, old_RUN, CurrentTime, username) VALUES ('" & WORKORDER_TYPE & "','" & WORKORDER_BASE_ID & "','" & WORKORDER_LOT_ID & "','" & WORKORDER_SPLIT_ID & "','" & WORKORDER_SUB_ID & "','" & SEQUENCE_NO & "','" & RESOURCE_ID & "','" & SETUP_HRS & "','" & RUN & "','" & strResource & "','" & strSetup & "','" & strRun & "','" & Now & "','" & strName & "' )"
Dim objRSUpdate
Set objRSUpdate = CreateObject("ADODB.Recordset")
Set objRSUpdate = objCNUpdate.Execute(strSQLQueryUpdate)
msgbox "logged"
End If
This gives me all the info on the operation and the new & old values(Setup, Run , Resource ID) along with when it was changed and by whom (via LDAP)
Important Links
Community Hubs
Discussion Forums
Groups
Community News
Popular Tags
CPQ: Ask a Colleague
FAQs, How-To, and Best Practices
Idea
Infor OS Portal
UI Design
CPQ: Tips and Tricks
Infor Homepages
Widget Development
Infor EPM Migration
Infor Ming.le