Page tree
Skip to end of metadata
Go to start of metadata

This example provides a simple view of how to use the Jabatix Workbench for extracting (into Business Objects-BOs), transforming (the data in the BOs), and loading (the results from the transformation) of a data source into a destination container (usually a database table).

Dim logger As LoggerUtil.Logger = LoggerUtil.getLogger(this)
' Set up Business Objects
Dim SalesInBOList  As BusinessObjectList = Query From SalesIn
Dim SalesOutBOList As BusinessObjectList = Query From SalesOut Writable
' Read each row from the input file, convert the date and write the information into the output file:
For Each SalesPerDayIn In SalesInBOList
    ' convert month as string into an integer (In a productive implementation, you will put this functionality into a library.)
    Dim mm As Integer
    
    Select Case SalesPerDayIn.month
        Case "September"
            mm =  9
        Case "October"
            mm = 10
        Case Else
            Throw New Exception("Month " + SalesPerDayIn.month + " is not suppoted by this demonstration code.")
    End Select
    
    ' convert the date over three attributes into one variable
    Dim dat As Date = Date.Factory.getDate(SalesPerDayIn.day, mm, SalesPerDayIn.year)
    
    ' print the transformed data:
    logger.notice("Date = " + dat + "     Sale = " + SalesPerDayIn.sales)
    '
    ' build a business object for output
    
    Dim SalesPerDayOut As SalesOut = SalesOut.createInstance()
    SalesPerDayOut.date  = dat
    SalesPerDayOut.sales = SalesPerDayIn.sales
    
    ' add it to the BusinessObjectList:
    SalesOutBOList.addNew(SalesPerDayOut)
    '
Next

' store the sales per day:
If Not SalesOutBOList.isEmpty()  Then
    SalesOutBOList.store()
End If
  • No labels