SQL View Branch Control
Branch Control Module

SQL View (Branch Control) is used to:
-
Restrict users to view or edit only the data belonging to their assigned branch
-
Protect data privacy between branches
-
Prevent users from accidentally selecting or modifying records from other branches
Scenario Example
Company has 3 branches:

Example users:

Project from other branches will be auto-filtered, preventing accidental selection of unauthorized or irrelevant data.
How to Set Branch Control Using SQL View
A. Project Filtering
A1. Single Project Code (e.g., PEN Branch – P1)
-
Tools | DIY | Maintain DIY

-
View Template | Right-click Project | New View Template

-
Click New

-
Set the Filter Condition
-
Description: Enter a name for this template
-
Code: Select Project Code
-
Condition: Equal
-
Value: Enter the project code (e.g., P1)

-
-
Select the new template form the list

-
Right-click Project | Select User View

-
Tick the user

A2. Multiple Project Codes(e.g., KL + SEL = P1 & P2)
-
Set the Filter Condition
-
Set Condition: is any of
-
Add project codes (P1, P2)
-
Click + if you need more codes

Results:
User can select both P1 and P2 only.

-
B. Agent Filtering
Scenario 1: Agent can only see their own documents
For Agent, if login user same as agent code, you can follow below step in the link on (Step 2) to get the ready view template and load side.
https://docs.sql.com.my/sqlacc/sql-mobile-connect/set-user-view
If not available, follow these manual steps:
-
May follow Project Filtering part Step1 and Step2 to create new view template
-
Choose Agent
-
Select ‘Equals’
-
Point the dropdown list
-
Select the current user. *current user = login user

Results:
When Yap opens any document, the Agent field will only show her own agent code

-
Scenario 2: Assign a user to a specific Agent Code
Type the Agent Code directly into the filter value

Results:
User will only see the assigned agent (e.g., Sales)

Other Modules Using the Same Steps
The same View Template steps apply to:
-
Area
-
Location
-
Stock Group
-
Stock Item
-
Payment Method
-
Account Code
How SQL View Affects the System
View Sales and Purchase Price History
If an SQL View is applied, the Sales Price History will only display values that pass the filter. Any values not permitted by the view will be excluded.
View Available Stock Balance
If an SQL View is applied for location, the View Available Stock Balance will only display the Total Qty belong to the location in Stock Card Qty, Qty in DO, Qty in PO and Available Qty.
Same as each Location Balance only refer to the location assigned.
Sales Invoice Transfer Dialog
When we transfer from Sales Order, if an SQL View is applied, the dialog will only display values that pass the filter. Any values not permitted by the view will be excluded.
All Report Listing
When SQL Views are used to restrict Agent, the Agent dropdown in reports will only show values allowed by the view. Same applies to Project, Location, Stock Item and Area etc.

-
ADMIN user is a superuser. Even if SQL View is applied, ADMIN can still view everything.
-
SQL View does not support Stock Transfer documents. Locking can only be applied via the DIY Script module.