Be.Smart ERP Connector
(EN) ERP Connector
(EN) ERP Connector
  • â„šī¸What is ERP Connector?
  • âš™ī¸System Requirements
  • 🆕What's New
    • Versions 29.2.1.0, 28.7.1.0, 27.13.0.0
    • Versions 29.1.0.0, 28.6.0.0, 27.12.0.0
    • Versions 29.0.0.1 & 28.5.1.1
  • Data Interface - Reference Manual
    • Abbreviations
    • Data interface
    • Data tables, relations
      • Table EcENTITY
      • Table EcASSOC
      • Table EcLINK
      • Table EcLOG
      • Stored procedure EcWriteEntity
    • Exporting data from a Vault
    • Properties / Attributes
    • Associations
    • Links
    • Reading data from data interface
      • Workflow sample
      • Another samples
    • Importing data into a Vault
    • Mandatory EcENTITY table fields
    • Default values
    • LifeCycle States
    • Writing data into data interface
      • Using SQL Stored Procedure
        • Example #1 – insert single EcENTITY record
        • Example #2 – insert two associated EcENTITY records
      • Using SQL syntax
      • Using SQL Management Studio
    • SQL views
    • ERP data displayed dynamically in VE Tab
    • SQL view definition sample:
    • ERP synchronized enums
    • Logging
    • Using thumbnail image data
Powered by GitBook
On this page
  1. Data Interface - Reference Manual
  2. Reading data from data interface

Workflow sample

here is a basic sample how to process data and report processing back into the data interface:

-- a variable to store the bulk ID currently being processed by your system 
DECLARE @BulkId INT = -1;

-- a variable to store the EcENTITY.id of the top entity within the current bulk ID 
DECLARE @EntId BIGINT = -1;

-- get the next pending bulk ID (data waiting to be processed by your system):
SET @BulkId = (SELECT TOP 1 bulk_id FROM EcENTITY WHERE comm_dir=0 AND comm_status=0 ORDER BY id)

-- update comm_status – the bulk processing has started
UPDATE EcENTITY SET comm_status = 1, processed1=GETDATE() WHERE bulk_id = @BulkId

-- get the top entity of the bulk structure
SET @EntId = (SELECT TOP 1 id FROM EcENTITY WHERE bulk_id=@BulkId AND EcENTITY.id NOT IN (SELECT
EcASSOC.ent_id_child FROM EcASSOC))

-- get a list of associations for the top entity – first level associations 
SELECT * FROM EcASSOC WHERE ent_id_parent=@EntId;

-- get a list of links for the top entity 
SELECT * FROM EcLINK WHERE ent_id=@EntId;

-- get a list of child entities in the first level
SELECT * FROM EcENTITY WHERE EcENTITY.id IN (SELECT ent_id_child FROM EcASSOC WHERE
ent_id_parent=@EntId);

-- XXXXXXXXXXXXXXXXXXXXXXXXXXX
-- write data into your system
-- XXXXXXXXXXXXXXXXXXXXXXXXXXX

-- report the bulk as successfully processed by your system

UPDATE EcENTITY SET comm_status = 7, processed2=GETDATE() WHERE bulk_id = @BulkId

-- or report an error
INSERT INTO EcLOG (ent_id, level, message) VALUES (@EntId, 1, 'unknown Unit of Measure') 
UPDATE EcENTITY SET comm_status = 9, processed2=GETDATE() WHERE bulk_id = @BulkId
PreviousReading data from data interfaceNextAnother samples