Appendix 2 – Exporting Transaction Data - Sage 300
Estimated time: 1 hr
In this example you will export transactional data and use the Database Writer to flag the exported transactions preventing them from being re-exported.
Method
- Sage Optional Field Setup
- Create A/R Invoice
- Set up a Database Reader
- Add the Map Transform
- Add the Excel Writer
- Create the second Map Transform
- Configure a Database Writer
Other Considerations
Sage Optional Field Setup
- Setup a ‘Yes/No’ optional field in Sage300.
- Assign the optional field to the relevant ledger & transaction.
- For training: A/R Invoices
- Ensure the following:
- Value Set
- Yes
- Default Value
- No
- Required
- No
- Auto Insert
- Yes
- This will automatically add an ‘EXPORTED’ optional field for every A/R invoice, with the default Value of No.
Create A/R Invoice
- Create an A/R Invoice in Sage300 and post the batch.
- After posting the transaction, you could query in SQL Manager either ARIBHO or AROBLO to see the optional field and the corresponding value.
Set up a Database Reader
- Return to IMan and create a new integration.
- Click the Transform Setup tab, add a Database Reader to the integration and double-click to open it.
- Select the Sage300 shared database connection that was setup in the previous task from the Database Connection drop down.
- Enter the following SQL Query:
- select I.IDCUST, I.IDINVC, IDCUSTPO, DATEDUE, TRXTYPEID, DESCINVC, AMTINVCHC
from AROBL I inner join AROBLO O on I.IDCUST = O.IDCUST and I.IDINVC = O.IDINVC and O.OPTFIELD = 'EXPORTED'
where LTRIM(O.VALUE) = '0'
- select I.IDCUST, I.IDINVC, IDCUSTPO, DATEDUE, TRXTYPEID, DESCINVC, AMTINVCHC
- Press Refresh.
- The query should return the AR invoices that were posted in step 5 above.
- Click the Field Mapping tab, change the Transaction Id to Orders.
- Press Save, then Refresh.
- Press Apply to save and close.
Add the Map Transform
- Add a Map transform to the integration.
- Double click to open it (and to initialise the transform setup), and then Close immediately.
- We will come back to this transform shortly.
Add the Excel Writer
- Add an Excel Write transform to the integration and connect it to the Map Transform.
- Double click to open.
- Expand the File Options and set the File Path and File Name accordingly.
- Press Refresh and open the file pointed by the File Path and File Name properties.
Create the second Map Transform
- Add a Map transform to the end of the Write transform.
- Create a new field:
- New Field Name
- VALUE
- Type
- Text
- Field Value
- 1
- This new field will be used in the next step to set the ‘EXPORTED’ optional field to ‘Yes’.
Configure a Database Writer
- Add a DB Writer to the end of the Map transform.
- Select the Sage300 Connection from the Database Connections drop down.
IMPORTANT: Set the SQL Operation to Update.
- Go to the Field Mapping tab.
- Set the following Map To Table to AROBLO.
- This is the table in Sage300 database that IMan will update.
- Set the Where Clause to:
- IDCUST = %IDCUST and IDINVC = %IDINVC and OPTFIELD = 'EXPORTED'
- For each record in the dataset the %IDCUST and %IDINVC fields will be substituted with the value of these fields within the IMan dataset.
- The effect will be to update only the records included in the dataset, as the IDCUST & IDINVC fields join to form the primary key for the AROBLO table.
- Edit the grid:
- Deselect each field except for VALUE
- Press green tick at the bottom of the grid to save.
- Return to Sage300 and view the Invoice through the Customer Inquiry:=.
- The ‘EXPORTED’ Optional Field will be set to Yes:
- Return to the first DB Reader and press Refresh; there should be an empty dataset.
Data Integrity Considerations
Please note we only recommend this method of updating data in the narrowest of scenarios. In this example, we have only changed a single Optional Field value.
Take-on Considerations
All Invoices prior to setting up the Optional Field will not have the EXPORTED optional field. Depending on your scenario you may need to perform an initial export where you export all records, then after the export is complete limit the DB Read by adding the where clause containing the optional field value.
CONGRATULATIONS! You’ve completed the Sage 300 Homework for IMan - now you deserve a drink!