Validating Transaction before posting
Before you allow PostTrans to Post a transaction into Sage 50 you may want to do your own validation.
Example: Press Help, on the PostTrans toolbar, then select example “Validating Transaction before posting” which is the example discussed below. You should also have read the "Importing Transactional Data" on the Training page for a basic understanding of PostTrans basics.
Example – Stop Transaction Posting
If we take the standard post a transaction template:
We can select cell C7, and add tag c, under the ‘Header’ tab of the PostTrans tags side bar. Thus we have:
We can now add a formula in cell C7
=IF(K9<30,"Margin below 30%","")
which says if the margin is below 30% then the cell contains a message “Margin below 30%".
If the cell is not blank then PostTrans will display the message held in the cell, with tag THBefDisplayMess. PostTrans will not allow the user to post the transaction into Sage Line 50/200 until the value has been cleared from cell C7,
The result would be:
Example – Stop Transaction Posting with Question
Tag THBefDisplayMessYN offers similar functionality, but the user is asked if the want to continue:
The following PostTrans tags allow the above functionality:
Tag Name
|
Data Type
|
Description
|
THBefDisplayMess
|
Text
|
If contains value, then this is displayed, and import cannot take place until this text if clear. Thus you can your own formula, macro or VBA code to stop import until a certain condition.
|
THBefDisplayMessYN
|
Text
|
If contains value, then this text is displayed. Asks Yes/No to continue
|
With data type Yes/No fields, if cell starts with 'y' or 'Y' is taken as TRUE
Where ^ denotes a Code Search field (Popup search window), delete ^ at end of tag, to turn off code search