Home : Using Location Levels
Q14460 - INFO: Using Location Levels

Location Levels were created to make it easier to query the Locations based on it's position in the tree.  The Levels (up to 8) are stored in the fields LVL1_ID, LVL2_ID,..., LVL8_ID.  The field ParentID is still used to setup and display the tree but the LVLx_ID fields are calculated.

Example:  I want to know any variable within the location Routine:

Routine is Location ID (LOCID) 55.  The following query only returns DS002, DS004, and DS005, not East, South, North or Inf. 

Select LocID,Location, ParentID
FROM LOCATION
WHERE PARENTID = 55

To get all the locations and their sub locations of Routine I can use the LVLx_ID fields.  In this case I want where Level 2 is Routine.  Routine's LOCID is 55 so the query becomes:

Select LocID,Location,ParentID,LVL1_ID,LVL2_ID,LVL3_ID,LVL4_ID
FROM LOCATION
WHERE LVL2_ID = 55

To get all variables in those locations:

Select VarNum,Name,Location
FROM VARDESC,LOCATION
WHERE VARDESC.LOCID = LOCATION.LOCID
AND LVL2_ID=55

 

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 7/17/2017 12:16 PM.
Last Modified on 7/17/2017 12:16 PM.
Last Modified by Scott Dorner.
Article has been viewed 1028 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article