Peter,
if you contain your uinobject calls in a class wrapper you can stay with
pure vb for application development.
With all subroutines you can even get by with only one argument if you
delimit your input and output with IM, FM, VM,SVMs and use the split
function to extract what you want.
As most problems can be solved with the subroutine call, get this right and
the rest is a cakewalk
eg here is an example of how to extract data from any file by passing
through the desired fields, dict items, conversions.
.
Private Sub StartPMFSearch()
On Error GoTo ErrorTrap
Dim iCnt As Integer
Dim sFlds() As String, sConvs() As String
Dim cBusy As cMouseBusy, itmX As ListItem
Dim sLastChar As String, sSelect As String
Dim sItems() As String, sRecord() As String
Dim vListrec As Variant, sErrorMsg As String
If chkQuickSearch.Value = vbUnchecked Then
ReDim sFlds(31)
ReDim sConvs(31)
Else
ReDim sFlds(1)
ReDim sConvs(1)
End If
Set cBusy = New cMouseBusy
cBusy.SetPointer vbHourglass
sFlds(0) = "0"
sFlds(1) = "VB.PRODUCT.NAME"
If Not mbQuickSearch Then
sFlds(2) = "VB.DIVISION"
sFlds(3) = "VB.PRODUCT.SUPER.GROUP"
sFlds(4) = "VB.PRODUCT.DIVISION.GROUP.AND.NAME"
sFlds(5) = "5"
sFlds(6) = "8"
sFlds(7) = "9": sConvs(7) = "MD4"
sFlds(8) = "10"
sFlds(9) = "11": sConvs(9) = "MD4"
sFlds(10) = "14"
sFlds(11) = "1"
sFlds(12) = "15"
sFlds(13) = "7"
sFlds(14) = "17,1"
sFlds(15) = "21": sConvs(15) = "D2."
sFlds(16) = "14"
sFlds(17) = "16"
sFlds(18) = "39"
sFlds(19) = "12"
sFlds(20) = "19" ' superceded
sFlds(21) = "VB.PRODUCT.LITRES": sConvs(21) = "MD2"
sFlds(22) = "VB.PRODUCT.WEIGHT": sConvs(22) = "MD4"
sFlds(23) = "VB.PRODUCT.VOLUME": sConvs(23) = "MD4"
sFlds(24) = "VB.PRODUCT.NET.WEIGHT": sConvs(24) = "MD4"
sFlds(25) = "VB.PRODUCT.BLOCK.QTY"
sFlds(26) = "VB.PRODUCT.QTY.PER.CARTON"
sFlds(27) = "VB.PRODUCT.QTY.PER.LAYER"
sFlds(28) = "VB.PRODUCT.QTY.PER.PALLET"
sFlds(29) = "VB.PRODUCT.DIMENSIONS"
sFlds(30) = "VB.PRODUCT.DEPOSIT.CODE"
sFlds(31) = "VB.PRODUCT.DEPOSIT.AMOUNT": sConvs(31) = "MD2"
End If
vListrec = "STPMF" ' file to be selected
vListrec = vListrec & FM & Join(sFlds, VM) ' Fields requested
vListrec = vListrec & FM & Join(sConvs, VM) ' Conversions to be applied
sSelect = "BY VB.PRODUCT.NAME.U"
If Len(gsPmFilterSelection) > 0 Then
sSelect = sSelect & " " & gsPmFilterSelection
End If
vListrec = vListrec & FM & sSelect ' Sort selection criteria
vListrec = UJ.DCallSub("*VGETANYFILE", 2, vListrec, sErrorMsg)
If UJ.ErrNumber <> 0 Then
MsgBox UJ.ErrDescription
Exit Sub
End If
With lvwSearch(0)
.ListItems.Clear
sItems() = Split(vListrec, IM)
lblFound(1).Caption = UBound(sItems) + 1
For iCnt = 0 To UBound(sItems)
sRecord() = Split(sItems(iCnt), FM)
Set itmX = .ListItems.Add(, , sRecord(0)) ' Product Number
itmX.SubItems(1) = sRecord(1) ' Product Description
If Not mbQuickSearch Then
itmX.SubItems(2) = sRecord(2) ' Division
itmX.SubItems(3) = sRecord(3) ' Super Group
itmX.SubItems(4) = sRecord(4) ' Product Group
itmX.SubItems(5) = sRecord(5) ' Stock Unit of Usage (UOM)
itmX.SubItems(6) = sRecord(6) ' Purchase Unit of Usage (UOM)
itmX.SubItems(7) = sRecord(7) ' Purchase Unit Conversion
itmX.SubItems(8) = sRecord(8) ' Selling Unit of Usage (UOM)
itmX.SubItems(9) = sRecord(9) ' Selling Unit Conversion
itmX.SubItems(10) = sRecord(10) ' Package
itmX.SubItems(11) = sRecord(11) ' Cost Code
itmX.SubItems(12) = sRecord(12) ' Classification
itmX.SubItems(13) = sRecord(13) ' GST/Tax Code
itmX.SubItems(14) = sRecord(14) ' Index
itmX.SubItems(15) = sRecord(15) ' Obsolete
itmX.SubItems(16) = sRecord(16) ' Aust. Product Number
itmX.SubItems(17) = sRecord(17) ' Sort Key 1
itmX.SubItems(18) = sRecord(18) ' Sort Key 2
itmX.SubItems(19) = sRecord(19) ' Supplier
itmX.SubItems(20) = sRecord(20) ' Superceded By
itmX.SubItems(21) = sRecord(21) ' Litres
itmX.SubItems(22) = sRecord(22) ' Weight
itmX.SubItems(23) = sRecord(23) ' Volume
itmX.SubItems(24) = sRecord(24) ' Net Weight
itmX.SubItems(25) = sRecord(25) ' Block Quantity
itmX.SubItems(26) = sRecord(26) ' Quantity / Carton
itmX.SubItems(27) = sRecord(27) ' Quantity / Layer
itmX.SubItems(28) = sRecord(28) ' Quantity / Pallet
itmX.SubItems(29) = sRecord(29) ' Dimensions
itmX.SubItems(30) = sRecord(30) ' Deposit Code (product)
itmX.SubItems(31) = sRecord(31) ' Deposit Amount
End If
Next iCnt
If .ListItems.Count > 0 Then .SelectedItem.Selected = False
End With
Exit Sub
ErrorTrap:
MsgBox Err.Number & ", " & Err.Description
End Sub
With writing data to Excel its even easier as you can paste records to rows
and avoid a for loop
jak
----- Original Message -----
From: "peter watson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 20, 2004 2:20 AM
Subject: RE: [U2] Error 30107 when calling SubRoutines from UniObjects
> The subroutines are note wrote or owned by us and we are not supposted to
create or alter them and they work fine if called by I-descripors therefore
I would believe they work. I have just replicated my VB.NET code in VB6 and
get the same error therefore I am going to give up and believe that the
company who wrote and own the subroutines have wrote them in a way that
means they can not be called from UniObjects.
>
>
> -----Original Message-----
> From: Ross Craig [mailto:[EMAIL PROTECTED]
> Sent: 19 May 2004 16:31
> To: [EMAIL PROTECTED]
> Subject: RE: [U2] Error 30107 when calling SubRoutines from UniObjects
>
>
> You should test all of your subroutines by calling them from universe
> before trying to get them to work in VB. You can use the debugger to
> step through your code. Create a calling program in universe to pass
> the subroutine the necessary parameters.
>
> Ross Craig
> Alaska Diesel Electric
>
> -----Original Message-----
> From: peter watson [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 19, 2004 7:12 AM
> To: [EMAIL PROTECTED]
> Subject: [U2] Error 30107 when calling SubRoutines from UniObjects
>
> Hi
> I am having problems with getting a response from any subroutine
>
> I get error number 30107 = The subroutine failed to complete
> successfully
>
> I have even tried setting Arg(0) to "" but nothing seems to work can
> anyone help me please.
>
> here is my code if anyone can tell me why its not working.
>
> Public Function doSubRout(ByVal sRoutine As String, Optional ByVal
> Params As String = "") As String
> ' if Connection failed exit function
> If Not Connect() Then
> MsgBox("No Connection", MsgBoxStyle.Critical)
> Exit Function
> End If
>
> Dim myErr As New UniErrors
>
> ' Exception on UniObjects Error
> m_uniobject.ExceptionOnError = True
>
> ' Create subRoutine Object
> Dim cu As Object = m_uniobject.Subroutine("MVACNOT", 4)
>
> If m_uniobject.Error <> 0 Then
> MsgBox("Error: (" & m_uniobject.Error & ") " +
> myErr.getErrStr(m_uniobject.Error))
> End If
>
> Try
> ' Get date in Universe format
> Dim Tod As New UniDate
> Dim sDate As String = Tod.GetUniDate(DateAdd(DateInterval.Day, 20,
> Now)).ToString()
>
> 'cu.Resetargs()
>
> ' Set subRoutine arguments
> cu.SetArg(0, "")
> If cu.Error <> 0 Then
> MsgBox("Error: (" & cu.Error & ") " + myErr.getErrStr(cu.Error))
> End If
> cu.SetArg(1, "ZA4")
> If cu.Error <> 0 Then
> MsgBox("Error: (" & cu.Error & ") " + myErr.getErrStr(cu.Error))
> End If
> cu.SetArg(2, sDate)
> If cu.Error <> 0 Then
> MsgBox("Error: (" & cu.Error & ") " + myErr.getErrStr(cu.Error))
> End If
> cu.SetArg(3, "OW")
> If cu.Error <> 0 Then
> MsgBox("Error: (" & cu.Error & ") " + myErr.getErrStr(cu.Error))
> End If
>
> ' call the subRoutine
> cu.call()
>
> If cu.Error <> 0 Then
> MsgBox("Error: (" & cu.Error & ") " + myErr.getErrStr(cu.Error))
> Else
> ' Display results
> MsgBox("Args: " & cu.GetArg(0) & "," & cu.GetArg(1) & "," & cu.GetArg(2)
> & "," & cu.GetArg(3))
> End If
>
> Disconnect()
> Catch ex As Exception
> ' Error handling
> If cu.Error <> 0 Then
> MsgBox(ex.Message + vbCrLf + "UniVerse : Error: (" & cu.Error & ") " +
> myErr.getErrStr(cu.Error))
> End If
> Disconnect()
> System.GC.Collect()
> Return ""
> End Try
>
> ' Return Result
> Return "Args: " & cu.GetArg(0) & "," & cu.GetArg(1) & "," & cu.GetArg(2)
> & "," & cu.GetArg(3)
> End Function
>
>
> This is the first line of the subRoutine I need to call
> SUBROUTINE MVACNOT(RETURN.SUPPLIER,ACCOM.CODE,REPORT.DATE,SEARCH.TYPE)
>
> When the system calls this subroutine internally it uses the following
>
> SUBR("MVACNOT",@ID,'DATE()','OW')
>
> Pete
>
>
>
>
>
> The information in this electronic mail message is Confidential and may
> be legally privileged.
> It is intended solely for the addressees. Access to this internet
> electronic mail message by anyone else is unauthorized.
> If you are not the intended recipient, any disclosure, copying,
> distribution or any action taken or omitted to be taken
> in reliance on it is prohibited and may be unlawful. The sender believes
> that this E-mail and any attachments were free
> of any virus, worm, Trojan horse, and/or malicious code when sent.
> This message and its attachments could have been infected during
> transmission. By reading the message and opening any
> attachments, the recipient accepts full responsibility for taking
> protective and remedial action about viruses and other
> defects. The sender's employer is not liable for any loss or damage
> arising in any way from this message or its attachments.
> -VRG3a-
> -------
> u2-users mailing list
> [EMAIL PROTECTED]
> http://www.u2ug.org/listinfo/u2-users
> -------
> u2-users mailing list
> [EMAIL PROTECTED]
> http://www.u2ug.org/listinfo/u2-users
>
> The information in this electronic mail message is Confidential and may be
legally privileged.
> It is intended solely for the addressees. Access to this internet
electronic mail message by anyone else is unauthorized.
> If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken
> in reliance on it is prohibited and may be unlawful. The sender believes
that this E-mail and any attachments were free
> of any virus, worm, Trojan horse, and/or malicious code when sent.
> This message and its attachments could have been infected during
transmission. By reading the message and opening any
> attachments, the recipient accepts full responsibility for taking
protective and remedial action about viruses and other
> defects. The sender's employer is not liable for any loss or damage
arising in any way from this message or its attachments.
> -VRG3a-
> -------
> u2-users mailing list
> [EMAIL PROTECTED]
> http://www.u2ug.org/listinfo/u2-users
-------
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users