Skip to main content

%SYS.PTools.FileCreation

Class %SYS.PTools.FileCreation [ Abstract, System = 4 ]

This class is a place to create File Creation & Formatting methods used by the PTools Application Package, which was designed to gather performance statistics for any type of Routine, Code Block or SQL Statement. The following methods are written to be used within Class Definitions, and the equivalent methods within the %SYS.PTools.FileCreation.INC file are written to be used within MAC Routines and are written as pure COS methods. The file formatted that these methods support are driven by the 'format' parameter and support the following formats: format - The output format of the Export/Reporting file This parameter has the following structure of constituent elements: format=[:$LB(,,)] Where the constituent elements have the following values: - The format of the Export/Reporting file: - P = Printable/Viewable report file (.txt file, no pagination) - D = Comma-delimited data file (.csv file) which can be read into a spreadsheet - X = Microsoft Excel XML markup file suitable for import into Excel (.xml file) - H = HTML page file (.html file) - Z = User-defined delimiter "P" formatted file (.dlm file) NOTE: The element is required or defaulted to $C(9) (TAB) Optional Elements: - User-defined delimiter [DEFAULT: $C(9) (TAB)] NOTE: This is generally used for ="Z" - .csv file header for ="D": - 0 = Don't add non-standard information header to file [DEFAULT] - 1 = Add non-standard information header to file - .csv file footer for ="D": - 0 = Don't add non-standard information footer to file [DEFAULT] - 1 = Add non-standard information footer to file EXAMPLES: Valid 'format' values: - "H" // HTML file - "D" // CSV file with No information header or footer - "D:"_$LB(,1,1) // CSV file with information header & footer - "Z:"_$LB("^") // User-defined delimiter file (delim="^") This class is Super-Class, and is used as part of the EXTENDS directive for the following classes: - %SYS.PTools.SQLQuery - %SYS.PTools.Stats - %SYS.PTools.StatsSQL - %SYS.PTools.SQLStats

Methods

createOrderByList

ClassMethod createOrderByList(orderBy = "", d) As %String

Create a valid SQL

condsMatch

ClassMethod condsMatch(conds, d, condValExp = "") As %Status [ PublicList = (conds, condValExp, d) ]

Check Conditional Matches

createAndOpenFile

ClassMethod createAndOpenFile(file, timeout = {$$$PTSOpenTimeout}) As %Status

Create & Open File

openFileForRead

ClassMethod openFileForRead(file, timeout = {$$$PTSOpenTimeout}) As %Status

Open File For Read

getOutputFile

ClassMethod getOutputFile(file = "", className = "", methodName = "", format = "", hDate = "", tSC = {$$$OK}) As %String

Get the 'outputFile'

fileHeader

ClassMethod fileHeader(file, format, title = "", class, method, version, metadata, bcFlag = "") As %Status

File Header

fileBody

ClassMethod fileBody(file, format, metadata)

File Body

fileFooter

ClassMethod fileFooter(file, format, footerMsg, metadata, elapseTime, rowCnt) As %Status

File Footer

TXTtabHead

ClassMethod TXTtabHead(metadata, delim)

Text Table Header

TXTtabRow

ClassMethod TXTtabRow(metadata, delim)

Text Table Data Row

CSVtabHead

ClassMethod CSVtabHead(metadata, delim)

CSV Table Header

CSVtabRow

ClassMethod CSVtabRow(metadata, delim)

CSV Table Data Row

DLMtabHead

ClassMethod DLMtabHead(metadata, delim)

DLM Table Header

DLMtabRow

ClassMethod DLMtabRow(metadata, delim)

DLM Table Data Row

XMLsheet

ClassMethod XMLsheet(name)

XML Worksheet Element

XMLtable

ClassMethod XMLtable(colCnt = 0, rowCnt = 0)

XML Table Element

XMLrowHeader

ClassMethod XMLrowHeader(metadata)

XML Header Row Element

XMLtabRow

ClassMethod XMLtabRow(metadata)

XML Table Data Row Element

XMLcolWidth

ClassMethod XMLcolWidth(width)

XML Column Width Element

XMLcolAuto

ClassMethod XMLcolAuto()

XML Column AutoFit Width Element

XMLsort

ClassMethod XMLsort(sortColList, sortOrderList)

XML Sorting Element

HTMLtabHead

ClassMethod HTMLtabHead(aTag, title, metadata)

HTML Table Header

HTMLtabRow

ClassMethod HTMLtabRow(metadata)

HTML Table Row