In certain cases, it may be useful to retrieve data from a remote session and update the current session's data with some additional info without needing to use the Lookup feature in TracerPlus.
An example of this is when reading multiple RFID tags to a Cached (Queued) grid. In some cases, you may need additional info about the RFID tagged items you are reading, however, if you were to enable lookups for this information it would slow down the RFID read process tremendously and doesn't always read all the tags.
Using SQL will allow you to quickly scan the tags, post them to the local session then execute a SQL statement to update information about the tagged item such as a description, pulling this information from a separate asset list based on the tag ID scanned.
Below is an example of a SQL statement that can be used:
UPDATE Session1 SET Field5 = (SELECT Field2 FROM Session2 WHERE Field1 = Session1.Field4) WHERE EXISTS (SELECT Field2 FROM Session2 WHERE Field1 = Session1.Field4)
In the example above, Session1 is the session used for scanning RFID tags, Field4 is the Tag ID and Field5 is the description field that will be updated by SQL. Session2 is our Asset List that contains a list of all Tag IDs (Field1) and their associated descriptions (Field2).
Note: SQL Statements cannot be used with sessions enabled for Live Mode. For more information on adding SQL to your TracerPlus sessions, see this article: https://support.tracerplus.com/article/216-writing-sql-queries-for-tracerplus