ConfigurationID=4 is the "@" configuration name. If you didn't filter it out, its values should show. Here's an updated query to only show values from @:
SELECT DISTINCT VV.ValueCache
FROM Documents D
INNER JOIN VariableValue VV ON D.DocumentID = VV.DocumentID
INNER JOIN Variable VR ON VV.VariableID = VR.VariableID
WHERE (VR.VariableName LIKE 'CurRevECO')
AND D.LatestRevisionNo = VV.RevisionNo
Order by VV.ValueCache DESC
Thank you Jason,
It doesn't work for some reason. No error message, but it just brings back zero values.
When I delete the "AND VV.ConfigurationID=4" line, It works, but just like before, with results from "Sheet1" tab in my drawings, without the results from @ tab.
Forgot to mention we're using ePDM 2013 if it makes a difference.
Also, the variable in the datacard is set to "update all configurations", but since it's drawings, sheets don't act exactly like configurations. Is there a way to collect values from all sheets, as oppose to all configurations?
OK, I got it. Now it works.
The problem wasn't just that the query returned values from wrong configurations, but that in returned history values as well, and not just the latest version values.
The support team of the local SW distributor helped me with the code:
SELECT DISTINCT ValueCache
FROM VariableValue VV
(SELECT DocumentID, ConfigurationID, VariableID, MAX(RevisionNo) AS RevMax
WHERE VariableID=(SELECT VariableID FROM Variable
-- replace the variable name below with the variable you need
WHERE VariableName='CurRevECO' and ConfigurationID='2')
GROUP BY DocumentID,ConfigurationID,VariableID) T
-- sort alphabetically
ORDER BY ValueCache