RCV - Row/Column Value

Usage

  value = RCV ( column tagarg )
  value = RCVi ( column tagarg )

Parameters

  value The numeric value returned as the row-column value
  column A non-tagged argument is considered to be a column specification. The result is returned as a point on that dimension (see examples below).
  tagarg One of the tagged arguments described below. Note that RCV can be called with no arguments.

Tagged Arguments

  Calc::level Returns the totals for the specified levels in a calculated column (one that does not display).
  Column::col Return the sum or count for the specified column. If the Column argument is not given then the next column is assumed. Note that delta values can be used to reference relative columns.
  Count::level Return a count rather than the sum for a level. The count corresponds to the number of detail rows in the level as opposed to the sum of the column values. All counts are returned as points on Dim:Int. The column number is significant for counts in that if an EchoS does not output a value for a column then its count is not incremented.
  Dim::dim The value is returned as a point on the dim dimension. The use of this argument overrides any non-tagged argument dimension/point-type determination.
  Row::num Specifies the row number. If not given then a recap is assumed
  Sum::level Return the aggregate sum for the specified level.

Description

The RCV module can be used within the Enum module to access multiple levels of totals. Level 1 is reserved for the grand totals. Higher levels can be used for additional levels of recapping. Both column sums and counts are maintained for each level. Referencing a level with RCV automatically clears all recaps at higher levels. If no level is specified, then level 2 is default except at end of processing when level 1 is default. A level need only be specified once, it then defaults for subsequent RCV calls. A call to RCV with no column specification defaults to the next column.

The default number of levels is 4. See the Recap and Calc tags within the Enum module for to increase this limit.

The RCVi module is equivalent to RCV(Dim:Int), i.e. it returns the total as a point on dimension Int.

Examples

  RCV(3) same as RCV(Sum::2 Column:3 Dim:Int)
  RCV(Sum::2 4.0) returns sum for column 4 as Dim:Num (4.0 is same as Num:4.0)
  RCV(Sum::2 Dim:Num 4) same as above (Dim:Num overrides use of Int:4)
  RCV() following the above, returns sum for column 5 as Dim:Num

ReAllocate - Reallocates (Redistributes) a List of Values

Usage

  true = ReAllocate ( srclist targetlist tagarg )

Parameters

  true This module returns Logical:True. The results are reflected in the bindings created.
  srclist A list of points to be used as the driver for the source values.
  targetlist A list of points to be used as the driver for the target or destination values.
  tagarg One or more of the tagged arguments below.

Tagged Arguments

  Bind::isct An intersection (or single point to be converted to an intersection) defining the resulting reallocation. A binding will be created for each point in the targetlist.
  Interval::ipoint Specifies the interval value for the source points.
  Method::method How the reallocation is to be performed. The allowed methods are Linear, First, and Closest.
  Overflow::opoint The opoint must be an intersection. Any leftover (overlow) value will be bound to this intersection.
  Target::tpoint The target interval
  Value::vpoint Defines the value for each of the points in srclist.

Description

The ReAllocate module redistributes a list of values on one interval to a new list of values over a different interval.

Examples

The example below demonstrates how this module can be used to redistribute yearly sales over the months in that year. The first list consists of the years, the interval for each year is the number of days, the value is the sales for the year, the target list is the months in each year with the target value being the number of days in each month. The result is a series of bindings of the form [Alloc UMonth:xx]=dollar corresponding to the ratio of (yearly sales * (days in month)/(months in year)).

Example 37 - Redistribution of Yearly Sales Over Months

  [MonthlySales UYear..]
  Do(Enum(UYear*
      (ReAllocate(UYear* Interval::ListSize(UDate:=UYear*)
       Value::[YearlySales] UMonth:=UYear* Target::ListSize(UDate:=UMonth*) Bind::[Alloc])
       Enum(UMonth:=UYear* @EchoT(UMonth* [Alloc]))
    )))

The next example allocates predicted expenses based on aircraft flight hours over months of actual flying time. The Model gives predicted costs for various intervals of flight hours. Each plane, however, does not necessarily fly the exact number of hours per month as predicted by each interval in the model. The [MonthList] is a list of months that the plane may have flown. The Target is the actual hours flown (which may be 0). The result is the allocation of the predicted costs by plane and month flown.

Example 38 - Allocation of Model to Actual

  [AllocateModelExpenses]
 Enum(Plane..
   @Reallocate(Model.. Interval::Model.Hours Value::Model.PredictedCost
               [MonthList] Target::[Plane* Month* Hours] Bind::[ModExpense Plane* Month*]))

Rpt - Module for Generating Reports

Usage

  value = Rpt ( tagarg ... )
  value = Rpt ( columnspec )

Parameters

  value The resulting value is based on the arguments
  columnspec A list of lists describing the next row of column values for the report
  tagarg One of the tagged arguments described below.

Tagged Arguments

  Begin::list The contents of the list are prepended to the report. This only applies to HTML type reports.
  Begin::file The contents of the specified file are prepended to the report. This only applies to HTML type reports.
  Bottom::text The text (a single line, mutliple lines or a list) is appended to the bottom of the report. This may be HTML or Javascript. The placement of this text is determined by the ##html.includeBottom## entry in v4rppcore.v4i file in the V4 home directory.
  Close::section The Close? option closes off the entire report. This option can be used to close off only the current portion of the report. At this time, the only supported option is SHEET which closes off the current sheet. Normally the Sheet tag closes off the current sheet and immediately sets up for the new sheet. It is not possible to inject any code (HTML, XML) between sheets. The Close:Sheet option closes the current sheet and allows for the output of any code before starting the next sheet.
  ColumnId::idlist Defines the column names to be used if XML is being generated. The form of idlist is a list of lists- ((colid xmltag) (colid xmltag) ...) where colid is a column identifier and xmltag is the XML tag name to be used for that column. If no explicit XML name is given for a column then its column identifier is used.
  Columns::collist Specifies a list of column identifiers (names) for the report. A column identifier may be an integer number or a dictionary entry with dictionary points being preferred. A group of columns may be given a single identifier by specifying a two-element list of the form (columnid columnnumber). For example, (a b c (d 5) e), defines a report of 9 columns. The first column is a, the second is b, etc. The identifier d represents a group of 5 columns between c and e. A contiguous group of columns may be redefined with another column name using a three-element list. For example, (a b c d (e a c)) defines four columns a, b, c and d. Column e is a reference to the three initial columns (a b c) of the report.
  Cookie::string This option specifies cookies that are to be set within the HTML report. The format of the argument is name=value;name=value... where name is the name of the cookie and value is its value.
  CSS::style The style parameter can be a string specifying a single CSS line or it can be a list of strings for multiple CSS lines. Multiple CSS tags may also be given for multiple CSS lines. If text includes braces '{...}' then it is assumed to be a style entry. If text does not include braces then it is assumed to be a URL link to a style sheet.
  Default::num Set the initial HTML report presentation. If num is 0 then show all lines of the report, if -1 then show lines via DataTable, if +n then show only n lines.
  Disable::colist This argument may be given to disable one or more columns of a report. A disabled column does not appear in the report. The format of colist is a list of column identifiers. Note that this option must be specified before any report headers or detail is output.
  Embed::html The html is to be embedded in the following column if the final report output is to be in HTML. If the output is not HTML then the html text is not embedded. More than one Embed argument may be specified. The pattern '\$' is used in the column text to denote the positioning of the embedded text. Each instance of '\$' is replaced with the next embedded html text.
  Grid::logical This option determines whether or not to display grid lines within Excel. If TRUE then grid lines are set, if FALSE (default) then not. Note: This has no effect on HTML output. CSS provides many options for grid lines, too many to be enumerated here.
  Heading::hlist Defines a heading line for the report columns. The format of hlist is a list of lists. A sublist may be either of two formats. The first is '(colid heading)' where colid is a column identifier and heading is the text heading value. The second format is '(startid endid heading)' where startid is a starting column, endid is an ending column identifier, and heading is the heading text to span the columns from startid through endid.
  HTML::enctag This argument is used to give enclosing HTML tags/text if the report type is HTML. Otherwise the argument is ignored. More than one HTML argument may be given.
  Id::rptid Associates a unique id to the report. This is only necessary if multiple reports are to be concurrently generated.
  If::condition This option allows one to associate a post-processor conditional to the remaining report arguments. The condition must be a valid xv4rpp 'If' expression.
  If::logical If TRUE (default) then output this line, if FALSE then do not output the line. However the values ARE included in any/all RCV totals.
  Image::file Inserts the specified image file into the next cell. This only takes effect for spreadsheet output.
  Image::list The list must be a two-element list of the form: (file url) where the file is used for output to a spreadsheet and the url is used for HTML output.
  Image::url Inserts the image url into the next cell. This only takes effect for HTML output.
  Job::number Assigns number as the meta-information tag ##jobNumber## within the post-processor.
  Library::url Defines either a javascript or CSS source url for the html post-processor. If the url extension is '.js' then javascript is assumed, if it is '.css' then CSS is assumed, otherwise the module fails. The v4rpp post processor inserts the correct script/css HTML wrappers.
  Link::option This determines how URLs are handled within spreadsheets. The allowed values are External to enable only links to external web sites. This is the default. None to disable all URL links. UserKey handles links to other application functions by forcing the user to log into the application and applying the security for that user. This means that a link can be embedded within spreadsheet that may not be viewable by all recipients of the spreadsheet. Secure assumes that the distribution of the spreadsheet is secure and anyone clicking on a link to an application function will be allowed to perform that function.
  Memo::string Assigns string as the meta-information tag ##memo## within the post-processor.
  Name::name Assigns name as the meta-information tag ##reportName## within the post-processor.
  Note::string Assigns a note or memo value to the next cell.
  Out::outid This binds the report output to a stream identified by outid. See the Output module for more information on output streams.
  Page::how Forces a page-break before the current line if how is Before, or after the current line if how is After.
  Privileges::privexp Assigns privexp as the meta-information tag ##privileges## within the post-processor.
  Row::ref Associates an identifier/key/reference with the row. This can be used as an argument to the Select row selection routine.
  Scale::num Scale the size of the page to num%. This only applies to Excel.
  Scale::keyword If keyword is FIT then scale the output to fit on one page. This only applies to Excel.
  Section::name Specifies the xv4rpp (HTML/Excel post processor) section to be used to process this report. Normally the section is 'main.v4r' or main.v4rMS (for reports with multiple sheets). This option overrides the default with the given name.
  Segment::name This specifies the row segment name to be used when XML is being output. If no Segment is given then the following defaults are used- <Heading> for header values, <Detail> for detail rows, <Recap> for recap (subtotal) rows, and <Footer> for total rows.
  Select::module Assigns a row selection module to the current sheet. The module should be a javascript function to be called when the row is selected.
  Server::url Assigns url as the meta-information tag ##serverURL## within the post-processor.
  Setup::jobsetup Assigns jobsetup as the meta-information tag ##jobSetup## within the post-processor.
  Sheet::name This argument is used when a report is composed of multiple sub-reports. The name is the name of the sheet to appear as an Excel sheet, or HTML division. If the output is XML then name is the name of the XML segment containing the sub-report. The name parameter may also be given as a two-part list, '(sheet xmlseg)' where sheet is the sheet name but xmlseg is the name given to the XML segment. Multiple Sheet arguments may be given for multi-sheet reports.
  Source::file Defines either a javascript or CSS source file for the html post-processor. If the file extension is '.js' then javascript is assumed, if it is '.css' then CSS is assumed, otherwise the module fails.
  Tag::tagval Assigns or appends a string to a report tag. This tag may be refernced by the V4R ⇒ HTML post-processor . The format of tagval is 'tagname=value' for assignment or 'tagname+=value' to append value to the end of the current value of tagname. The tag can be referenced as '##tagname## within the post-processor.
  Title::ttext This argument defines the title for the report. This argument can be given more than once for multi-line titles. (Or the title can be specified as a single string with the character sequence '\l' being used to denote line breaks.
  Top::text The text (a single line, mutliple lines or a list) is prepended to the beginning of the report. This may be HTML or Javascript. The placement of this text is determined by the ##html.includeTop## entry in v4rppcore.v4i file in the V4 home directory.
  Type::rpttype Defines the type of report. The rpttype argument can be one of- V4R (default) to output a V4 results file (for post-processing), CSV for comma-delimited unformatted output, HTML for HTML output, Tab for tab-delimited unformatted output, or XML for XML output.
  URL::urlval Associates a URL link to the next column. This only applies to HTML and V4R type reports. If urlval begins with a '+' then the URL is assumed to be associated with a URLBase and the urlval is concatenated onto the end of the base when the link is clicked. If the next character is a digit (0-9) and the following character a comma, then the urlval is associated with the corresponding URLBase from one to ten (1 or no digit corresponds to the first base, 2 the second, through 0 which references the 10th). See, also, the section on contextual formatting below. This tag may also be included within a Heading list for specifying links within a report heading.
  URL::list If a list is given then the first element of the list is the URL link (see above). Any additional list elements are optional tagged argument for the link. Currently the only supported option is Target::window where window specifies the target window for the link. Details on valid targets can be found here.
  URLBase::baseval Specifies a base URL value. Up to 10 different bases can be given for a report. If more than one is specified then baseval must be a list containing the the bases. See below for more discussion.
  User::name Assigns name as the meta-information tag ##userName## within the post-processor.
  Version::vstr Defines a version string for the report (meta-information tag ##version##).
  XML::xml Specifies one or more XML tags to enclose the report. This argument only applies to XML type reports. If the argument is UV4:none then it is ignored.

Tagged Results

  Close? Closes the report and frees all internal resources associated with the report. A report should always be closed with this option as it lets any of the V4 post-processors know that the report has finished normally. Note that this does not close the output stream of the report.

Description

This module is used to generate reports. When used properly many properties of the report can be easily modified. The Type argument can be used to vary the output from unformatted text, XML, or HTML without having to change other report parameters. The contextual formatting provides a simple, yet powerful mechanism for altering the format of report rows, columns, and cells. Columns of a report can be easily shifted or disabled,

Formatting of rows, columns, and cells can be done in two fashions. The first is through the use of dimensions and the SSDim module. The other is by using special dimensions and UV4 values to define bindings that are automatically evaluated as part of the Rpt module processing. If any of the following dimensions are defined then they are automatically updated in the context with the values described: URptL (Integer) is updated with the current detail line number, URptR (Dictionary) is updated with the report type (V4R, Tab, CSV, HTML, XML), URptS (Dictionary) is updated with the report sheet name (if sheets are defined), URptT (Dictionary) is set to the current line type (Default, Heading, Detail, Recap, Footer), and URptV (Shell) is updated with the current cell value.

The current column id or name is always inserted into context as-is. If a column consists of multiple sub-columns then an addition point may be added to the context if the dimension, URptSG (Integer) is defined. Its value will range from 1 (the first sub-column to the maximum number of sub-columns).

For each report entry, the following are evaluated in the order given- [UV4:ColFormat] for any column formatting, [UV4:RowFormat] for any row formatting, [UV4:CellFormat] for any cell-specific formatting, and [UV4:Link] for any URL linking to be applied. See the example below, click here to see the result.

Note: If you plan on using any of the above features then the associated dimensions (e.g. Dim:URptR, Dim:URptT, etc.) must be defined before the first call to the Rpt module. Binding incorporating these dimensions my be defined at runtime with the BindQE module but the dimensions must be pre-declared. V4 checks for the existence of these dimensions with the first Rpt call to determine whether or not to check on each subsequent call.

The first call to this module binds the report to the current DATA output stream. All subsequent call to the module output to that stream even if the default stream is different within the scope of the module call. This may be overridden with the Out tagged option.

The Rpt module is integrated with the XML option in the Do and EchoS modules. If a report is sharing the same output stream as the Do or EchoS module then the implied output from the XML tag is only performed when the report type is XML or HTML. No output is performed when the report type is V4R, Tab, or CSV.

Examples

  Rpt(Columns::(a b c d e f)) Defines a report with 6 columns
  Rpt(Disable::(c e)) Disable columns c and e
  Rpt(URLBase::([base1] [base2] [base3])) Defines 3 URL base strings
  Rpt(URL::"+xxxxx") Associates with the first base string
  Rpt(URL::"+2,...") Associates with the third base string
  Rpt(Columns::(a (b ListSize([hList]))) Declare a report with variable number of column b's
  Rpt(Heading::MakeL((a "moo") MakeL(b (MakeP(Tag:URL Str("www.moo.com?Int=" xx*)) Str("b-" xx*))/Num(x:1 To ListSize([hList]))))) Include URL links within a dynamic heading

Example 39 - Using the Rpt() Module for Complex Formatting

  Dim URptS, URptT, URptR Dictionary
Dim URptL Int
Dim URptV Shell
 
Dim RType Dict
Dim TR Alpha
 
[UV4:ColFormat c URptT:Default] TextColor::Red
[UV4:RowFormat URptT:Detail URptL..]
 If({MthMod(URptL* 2) = 0} Then::CellColor::LightGrey)
[UV4:CellFormat d URptT:Detail] If({Int* > 3} Then::TextColor::ForestGreen)
[UV4:CellFormat b URptT:Detail] Format::"#,###.0"
[UV4:URL a] If({Int* = 2} Then::"+?Page=125")
[Test RType..]
 Do(
    SSDim(Dim:Int TextColor::Purple Dim:TR Style::"Right")
    rpt(id::fred Type::RType* Columns::(a b c d) xml::"table border='1'" URLBase::"http::/www.mksinc.com/"
        CSS::"table { border-collapse: collapse; background: transparent ; font-family: Arial; font-size: smaller ; }"
        CSS::"td { padding: 3px; }"
        CSS::"a:link { text-decoration: underline; color: blue }"
        CSS::"a:visited { text-decoration: none; color: green }"
        CSS::"a:hover { text-decoration: underline ; color: purple }"
     Title::"First Title Line" Title::"(and second)" Version::"test-1.0")
 
    rpt(heading::((a c "This extends")))
    rpt(heading::((a now) (c the) (b TR:is) (d "time for")))
    Enum(Int:1..5
      @Rpt(((c "xx") (a "Line") (b {Int* * 10000}) (d Str("Line " Int*))))
      End::(1 Rpt((b RCV(b))))
        )
    rpt(close?)
   )