Yes in a Nutshell if you have a SQL Connector configured on the Server or on the Users PC then yes it can.
Example when you use Print Station I also write to the UD Serial Numbers table to remain in Sync.
You just have to add this into the OnPrintStart Event:
Note: you can omit the Login Credentials if you have SQL Connector in ODBC Settings via Control Panel Configured.
Set objConn = CreateObject("ADODB.Connection")
'objConn.Open "DRIVER={Progress OpenEdge 10.2A Driver};HOST=DELL-T710;PORT=9450;DB=mfgsys;UID=sysprogress;PWD=sysprogress;DIL=READ COMMITTED"
objConn.Open "Driver={SQL Server};Server=THINKSERVER;database=E10_Code;uid=sa;pwd=whatever"
Then inside the Functions Shared Event I put methods in like this:
'================================================
' Function to Generate a Serial Number based on
' a algorithm
'================================================
Function GenerateSerialNumber(BTValue)
'Initialize Variables
Dim min, max, serialNum
'Set Min and Max
min = 1
max = 9
'Initialize Random Number Generator
Randomize
'Return Serial Number
serialNum = (Month(Date) & (Day(Date)) & (Int(Timer) ))
GenerateSerialNumber = Int(serialNum) & BTValue
End Function
'================================================
' Function to Ask the Database what is the next
' usable Serial Number we should use
'================================================
Function GetNextUsableSerialNumber(objRecordset, BTValue)
Dim suggestedSerial
objRecordset.Open "SELECT TOP 1 * FROM Ice.UD07 WHERE Number09 = 200 AND (Date01 BETWEEN '" & Date()-350 & "' AND '" & Date() & "') ORDER BY Number20 DESC", objConn, adOpenStatic, adLockOptimistic, adCmdText
If objRecordset.RecordCount > 0 Then
objRecordSet.MoveLast
suggestedSerial = Int( objRecordSet.Fields.Item("Key3") )
objLog.WriteLine "Records Found: " & objRecordset.RecordCount
Else
suggestedSerial = 100000000
End If
objRecordset.Close
'BTValue is no longer used but reserved
GetNextUsableSerialNumber = Int(suggestedSerial) + 1
End Function
'================================================
' Function to Check if a Serial Number is already
' being used anywhere.
'================================================
Function CheckSerial(objRecordsetSerialCheck, serialNum)
Dim returnValue
objRecordsetSerialCheck.Open "SELECT * FROM Ice.UD07 WHERE Key3 = '" & serialNum & "'", objConn, adOpenStatic, adLockOptimistic, adCmdText
objRecordsetSerialCheck.Find "Company = 'DIEN'"
If objRecordsetSerialCheck.RecordCount > 0 Then
returnValue = Int(objRecordsetSerialCheck.RecordCount)
Else
returnValue = 0
End If
objRecordsetSerialCheck.Close
CheckSerial = Int(returnValue)
End Function
'================================================
' Generate our Index Variable
'================================================
Dim currentIndex
currentIndex = 1
'================================================
' Define our Database Needed Variables
'================================================
Dim objConn
Dim strConn
Dim objRecordset
Dim oField
'Define Database Connection parameter constants.
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001
Of course you can then manipulate other objects etc…