This week’s Tech Tuesday is from our Senior Technical Consultant, Chris Hanson, who will show us the easiest method to tracking the Source Company in a Real-Time Map.
One of our features in SmartConnect is a real-time data source that allows maps to automatically execute when a certain event is triggered. When using a GP real-time source you can setup that source once to be used across every GP company if needed. The issue is then how you can identify which company the event/data comes from as that is not tracked by default within the source.The easiest method to track the source company is to use the DB_NAME() function that is built into SQL. That statement can be added to any SQL based data source (real-time or otherwise) in order to identify the database the data is coming from as it will return the current database if no parameter is passed into it.
For a real-time map, that function would be added within the query builder when setting up the source. In the screenshot below, DB_NAME() was added as an expression with the Alias for that result set to SourceCompany so it is easy to identify when looking through the columns while building the actual mapping.
The result of that function should return the SQL name of the database/company that the data is coming from. So if we were using the Fabrikam company to test this map, it would have TWO set as the value when triggered from that company. That value can then be used in restrictions, tasks, or other additional columns as needed to ensure the data is processed correctly when the map runs.