Using GICS Indices for base and sub-industry symbols in RS Plot

I have all of the GICS Sector, Industry and Sub Sector indices in my database and all of the securities in my database have been assigned their into their respective classifications. I am trying to determine the best way to how to use them to plot a symbol against its GICS Structure in creating an RS Plot. I have assigned for example S5FINL Index (Bloomberg symbol) as the Sector for the Industries in the Symbol Categories.

I found where Tomasz showed how to pull the number for the GICS Structure

gics = GicsID( 0 );
level1 = StrToNum( StrLeft( gics, 2 ) );
level2 = StrToNum( StrLeft( gics, 4 ) );
level3 = StrToNum( StrLeft( gics, 6 ) );

Is there a way to reference that Gic Sub-Industry symbol of VLO-Valero for example which is 10102030 (GICSID(0) and assign its Trading Index Symbol (Bloomberg S5OILR Index) to use in the plot? Ideally it would be great to reference all 4 levels of the GICS structure.