AnsweredAssumed Answered

AF Table Lookup attribute template

Question asked by tinklerj on Apr 11, 2019
Latest reply on Apr 11, 2019 by sraposo

I'm trying to create an attribute template which does a table lookup.

Say I have 3 units and a lookup table for each one (with different result values).  So I've created 3 tables 01_TableA, 02_TableA, 03_TableA.  They have column names X (the lookup values, which happen to be the same in each case) and Result (the corresponding data values).

In the unit element template the unit number is a string attribute "Number" (= "01", "02", "03").

So I can create a StringBuilder attribute template "TableA" for the right table name (|Number;"_";%Attribute%;).  For Unit 1 this resolves to the string "01_TableA", and so on.

Now I want to create a Table Lookup Data Reference attribute template, called say "LTableA", that interpolates the value of a root attribute "LookupVal" in the table.

I want the data reference string to evaluate to "SELECT Result FROM [01_TableA] WHERE INTERPOLATE(X, @|LookupVal)" for Unit 1, etc.  For the bit in italics I want to substitute the value of attribute TableA (or get the correct table name some other way).  I tried just using @|LTableA by analogy with the lookup value, but it doesn't work, just says "The table @|LTableA ... doesn't exist".

Using substitution strings (%@|TableA%) doesn't work either.

I can't find a syntax that works in a template to resolve to the unit-specific table name from the attribute TableA.  There must be a way to do this surely?

Outcomes