Using the Locations Served or portloca flat file in a query with iii_user

In the iii_user table, there exists a numeric column named location_group_port_number.  This column is effectively a foreign key, but not to any table found in the Sierra PostgreSQL database.  Instead it refers to the IDs assigned to each Locations Served entry defined in Admin Corner, and this data lives in the flat text file /iiidb/data/portloca.

I am in the process of adding hundreds of Sierra logins [long story] and wrote a SQL query to track my progress and QA my work.  Since the locations served assignment is critical when configuring a new Sierra login, I wanted the query to display the locations served name instead of a meaningless numeric ID (which does not correspond to the menu item number displayed in Admin Corner).  We are Clarivate-hosted, so I opened a support case requesting that a copy of the portloca file be deposited in one of the Data Exchange folders.  Support turned the request around promptly, and I used the first two fields in the portloca file to populate the temp table in the query below.  May you someday find this useful. :jack_o_lantern:

Track Mobile Sierra Logins.sql (3.2 KB)