generate/cbs2.gif Sales Order Import Hook (R-OEGATE.MAC)

E-Gate Services Only


 

The script file must be located in your CAPITAL program directory and must have the file name R-OEGATE.MAC

If the script is found, it is executed just before a OEEGATE card file record is transferred to a sales order. The script is useful for altering card file information before importing.

Entry Values

OEEGATE-> fields.

Mode -> The import task number being executed. This is a number value representing the import task number.

Return Values

None.

Comments

When the script is executed the OEEGATE card file is open and the next record to be processed is visible. The record is also already locked so the LockRecord() function does not need to be called. Do not unlock the record from the hook.

generate/notepad2.gifIt should be noted that even if you have specified a different card file to import transactions into, you should always refer to the card file by the table name of 'OEEGATE' using this hook. For example, if you are importing ETR data into a card file called OERETRA this table will still be visible to the import hook by the name of OEEGATE.

Example

In this example the ETR file to be imported as two problems. The organisation supplying the file was unable to include an order date or a customer account code. Fortunately (in this example) the order date can be assumed to be equivalent to the date of import. The script will also attempt to match the customer name, which is mapped to the field OEEGATE->Name, against the customer name in CAPITAL's customer file. If found, it fills it into the card file also.

* Check the mode to only execute this section of

* script for Task #1

If Mode = 1

   If IsEmpty(OEEGate->Date)

      OEEGate->Date := Today()

   Endif

   IF IsEmpty(OEEGate->Account)

      If Custrec->(Find(Upper(Trim(OEEGate->Name)), "Name"))

         OEEGate->Account := Custrec->Cuscode

      Endif

   Endif

   Return

Endif

____________________________

Related Topics:

E-Gate Services

Scripting Hooks

Script Programming

 

 

 



Help Topic Map