AnsweredAssumed Answered

How do you display multiple variables in a report

Question asked by Cory Engdahl on Oct 31, 2014
Latest reply on Dec 16, 2014 by Brent Lewis

I am attempting to write a SQL query to generate a report pertaining to a form we circulate with workflow.

 

The form is an Excel document and has many variables liked to it an ideal report header would look something like this:

 

File Name   Created By  Quote Number  Customer Name Status 

 

 

I am wondering how I take columns from the Variable.VariableName table in the database, and turn them into tables containing ValueText.  I can successfully do this with one variable; however, in order to do this with multiple variables, it seems I would have to create a second instance of table in the query.

 

For example, this results in a list of only one variable, where I want several:

 

SELECT     D.Filename

                 ,Vv.ValueText AS 'name of variable'               --Lists text values of variable

FROM        Documents AS D

                 ,VariableValue AS Vv

                 ,Variable AS V

 

WHERE     DocumentId = Vv.DocumentId

                 AND V.VariableId = Vv.VariableId

                 AND V.VariableName = 'variable name'          --Limits query to desired variable

                 AND D.Filename LIKE '%name of form%'

 

Thanks

 

-Cory

Outcomes