Description
Changing between databases on the fly without the need to restart SambaPOS with a push of a button. Had this request from a client (to check old reports, accounts etc) so decided to share it on the forum since there is no actual tutorial for this.
Requirements:
-
SQL Server Express 2014 - 2017
-
Custom Navigation Screen
-
SambaPOS 5.3.0 (tested on it)
Tutorial:
Actions
Action - Change Database Connection
Name: Change Database Connection
Save To Local Settings: [:SaveToLocalSettings T/F]
user Pin: [:UserPIN]
Reset To Default Connection: [:ResetToDefaultConnection T/F]
Action - Logout User
Name: Logout User
Reset Cache: True
Logout Admin: True
Automation Commands
Automation Command - SQL Connection String
Name: SQL Connection String
Category: Navigation
Button Header: SQL String
Navigation Settings Template:
<size 46><sym></sym></size>
<size 48><bold>SQL String</bold></size>
Rules
Rule - SQL Connection String
Name: AMC SQL String
Event Name: Automation Command Executed
Custom Constraints: Execute rule if Matches
Automation Command Name
Equals SQL Connection String
Actions:
Change Database Connection
Constraint:
String:
Data Source=DESKTOP-TFJ218C\SAMBAPOS; User Id=sa; Password=sambapos; Database=[?Database;;{REPORT SQL DETAILS:SELECT name FROM master.sys.databases WHERE database_id > 4 ORDER BY name:F.name::|};OCS;]
SaveToLocalSeetings T/F: True
User PIN:
ResetToDefaultConnection T/F:
Execute Automation Command
Constraint:
Command Name: Logout User
Rule - Logout User
Name: AMC Logout User
Event Name: Automation Command Executed
Custom Constraints: Execute rule if Matches
Automation Command Name
Equals Logout User
Actions:
Logout User
Constraint:
Import File
Change SQL Connection Button.zip (1.3 KB)