SQL Post Processing PDF
SQL Post Processing PDF
Home > Presentation Services > Excel Add-In > VantagePoint Function Wizards > History
Function> SQL Post Processing
SQL Post Processing
The SQL Post Processing facility is available as an option within the Add-In History Wizard to
transform the times series result set into different result sets. The functionality is based on a query
specification in the SQL Post Processing wizard page.
This wizard is available in the Excel reports and Dashboard report definition.
The wizard has a set of predefined Query templates (which are dependent on the wide/narrow
History request setting).
Queries can be added and modified in the SQL query text field. At any stage the query can be
tested (without applying the result to the spreadsheet) by clicking the [Test] button in the wizard
page.
pdfMachine
A pdf writer that produces quality PDF files with ease!
Produce quality PDF files in seconds and preserve the integrity of your original documents. Compatible across
nearly all Windows platforms, simply open the document you want to convert, click “print”, select the
“Broadgun pdfMachine printer” and that’s it! Get yours now!
http://usmvijdarnold5a/Incuity//Documentation/WebHelp/PresentationServices/Excel/Func... 1/20/2012
SQL Post Processing Page 2 of 7
Once the query has been refined the [Next], [Finish] allows the result set to be applied to the
spreadsheet. The SQL Post Processing is functionality is described below in the Narrow and Wide
table cases.
pdfMachine
A pdf writer that produces quality PDF files with ease!
Produce quality PDF files in seconds and preserve the integrity of your original documents. Compatible across
nearly all Windows platforms, simply open the document you want to convert, click “print”, select the
“Broadgun pdfMachine printer” and that’s it! Get yours now!
http://usmvijdarnold5a/Incuity//Documentation/WebHelp/PresentationServices/Excel/Func... 1/20/2012
SQL Post Processing Page 3 of 7
Duration query
The Duration query is based on a predefined stored procedure [ts_Duration]. This stored procedure
transforms the #TimeSeries table into a result set of TimePeriod’s, returning columns Start,
End and Duration (seconds).
The [ts_Duration] stored procedure has a parameter @aOrdering INT which defaults to 0
(ascending Start ordering) if not specified, if set to a not 0 value the ordering will be descending
Start ordering.
EXEC [dbo].[ts_Duration] -- Ascending Start ordering
EXEC [dbo].[ts_Duration] @aOrdering = 1 -- Descending Start ordering
Example:
EXEC [dbo].[ts_Duration]
Results:
Time-In-State query
The Time-In-State query is pertinent to a single Tag of type Discrete, Integer Analog or String.
The Time-In-State query is based on a predefined stored procedure [ts_TimeInState]. This
stored procedure transforms the #TimeSeries table into a result set of columns Start, End and
Duration (seconds) and TagValue.
The [ts_TimeInState] stored procedure has a parameter @aOrdering INT which defaults to 0
(ascending ordering) if not specified, if set to a not 0 value the ordering will be descending.
EXEC [dbo].[ts_TimeInState] -- Ascending Start ordering
EXEC [dbo].[ts_TimeInState] @aOrdering = 1 -- Descending Start ordering
Example:
EXEC [dbo].[ts_TimeInState]
Results:
pdfMachine
A pdf writer that produces quality PDF files with ease!
Produce quality PDF files in seconds and preserve the integrity of your original documents. Compatible across
nearly all Windows platforms, simply open the document you want to convert, click “print”, select the
“Broadgun pdfMachine printer” and that’s it! Get yours now!
http://usmvijdarnold5a/Incuity//Documentation/WebHelp/PresentationServices/Excel/Func... 1/20/2012
SQL Post Processing Page 4 of 7
Count-In-State query
Count-In-State query, returns Count of Occurrences, Tag Value
The Count-In-State query is pertinent to a single Tag of type Discrete, Integer Analog or String.
The Count-In-State query is based on a predefined stored procedure [ts_SumInState]. This
stored procedure transforms the #TimeSeries table into a result set of columns Sum(Duration)
(seconds) and TagValue.
The [ts_TimeInState] stored procedure has a parameter @aOrdering INT which defaults to 0
(ascending Sum(Duration) ordering) if not specified, if set to a not 0 value the ordering will be
descending Sum(Duration) ordering.
EXEC [dbo].[ts_CountInState] -- Ascending Count ordering
EXEC [dbo].[ts_CountInState] @aOrdering = 1 -- Descending Count ordering
Example: pdfMachine
A pdf writer that produces quality PDF files with ease!
Produce quality PDF files in seconds and preserve the integrity of your original documents. Compatible across
nearly all Windows platforms, simply open the document you want to convert, click “print”, select the
“Broadgun pdfMachine printer” and that’s it! Get yours now!
http://usmvijdarnold5a/Incuity//Documentation/WebHelp/PresentationServices/Excel/Func... 1/20/2012
SQL Post Processing Page 5 of 7
#CoveredTimePeriod table
The #CoveredTimePeriod has one row which specifies the StartTime and EndTime columns
which indicate the request TimePeriod.
Example:
SELECT * FROM #CoveredTimePeriod
Results:
#RefName table
The #NameRef table is a lookup table which correlates the ItemId, TagName and TagFQN for
the Time Series request.
Example:
SELECT * FROM #NameRef
Results:
pdfMachine
A pdf writer that produces quality PDF files with ease!
Produce quality PDF files in seconds and preserve the integrity of your original documents. Compatible across
nearly all Windows platforms, simply open the document you want to convert, click “print”, select the
“Broadgun pdfMachine printer” and that’s it! Get yours now!
http://usmvijdarnold5a/Incuity//Documentation/WebHelp/PresentationServices/Excel/Func... 1/20/2012
SQL Post Processing Page 6 of 7
You can perform a JOIN between #TimeSeries and #NameRef to get the required TagName and
TagFQN:
SELECT NR.TagName, NR.TagFQN, TS.TimeStamp, TS.Value
FROM #TimeSeries TS JOIN #NameRef NR
ON TS.ItemId = NR.ItemId
#TimeSeriesName table
Using on TagName value column names
#TimeSeriesFQN table
Using on TagFQN value column names
#RefName table
Same as the definition in Narrow Table Case above.
Limitations
Excel formula length limitation
The Excel function specification has a length limitation of 255 characters. If a long query is entered
it will be truncated and will not work.
pdfMachine
A pdf writer that produces quality PDF files with ease!
Produce quality PDF files in seconds and preserve the integrity of your original documents. Compatible across
nearly all Windows platforms, simply open the document you want to convert, click “print”, select the
“Broadgun pdfMachine printer” and that’s it! Get yours now!
http://usmvijdarnold5a/Incuity//Documentation/WebHelp/PresentationServices/Excel/Func... 1/20/2012