400 and RPT-0143. The detail names the point to correct, for example query 'saldos_cosif'. See the error list.
Example
This mapping fills two sets of CADOC 4010. The query
saldos_cosif adds up the approved entries of each route_code that were created before the end of the period of the parameter dataBase. A credit adds its amount. A debit subtracts it. The published reference mapping for this document also filters on the BRL asset, on entries that moved a balance, and on rows that are not deleted. It also cuts the end of the period by the business calendar.
How Reporter reads the document
- The document must be YAML. An empty document is refused. The top level must be an object of keys and values.
- Each block takes the keys in its table on this page. A block with any other key is refused. The refusal lists the keys that the block takes.
- A known key with no value counts as not written.
- A required text cannot be empty.
- Reporter reads a value as the text that you write.
7and"7"are the same value. - Reporter accepts YAML anchors and aliases. It refuses the merge key
<<. - Two queries cannot share a name. Two sets cannot share a name. Two fields of a set cannot share a name.
- These names must match a query of the mapping: the
fromof a query, thequeryof thefromof a set, thequeryof a join, and thequeryof a field of a set. A query can be declared after the set or query that refers to it.
Top-level keys
Queries
A query reads rows from your data. Sets and other queries refer to a query by its name.
A query is refused when:
- it has neither
dataSourcenorfrom; - it has
fromand alsodataSourceortable; - it has
dataSourceand notable; - its
fromnames itself, names a query that the mapping does not declare, or closes a ring with other queries.
Filters
A row stays when it passes each condition offilters. Conditions on the same column all apply.
A condition is a test or a combination:
A condition needs
field and operator, or anyOf or allOf. These operators are accepted:
To exclude rows by prefix, use
notStartsWith. This filter drops the rows whose route_code starts with 7 or 8:
- it has a key other than
field,operator,values,anyOf, andallOf; - it has
fieldand alsoanyOforallOf; - it has neither
fieldnoranyOforallOf; - it has
fieldand nooperator; - its
operatoris not in the table. The refusal lists the accepted operators; - it has
isNullornotNullwith values or a parameter; - it has
betweenwith a parameter, or with a number of values other than two; - it has any other operator with no value and no parameter.
filters on one column are refused when they use the same operator. They are also refused when one of them is isNull or notNull. Two different operators on one column combine, which is how you write a period: gte for its start and lt for its end. A generation refuses between beside gte or lte.
Values read from a parameter
A parameter is a value that you send in the generation request. An item ofvalues that is an object reads one parameter:
Without
at, the condition compares with the value of the parameter as the request carries it. With at, the parameter names a period: AAAA-MM for a month, AAAA-MM-DD for a day. The edges follow the report time zone. start is the first instant inside the period. end is the first instant after it. Compare start with gte and end with lt. No instant then falls in two periods or in none.
With calendar: business, a period ends right after its last business day. It starts right after the last business day of the period before.
This query reads the month of the parameter, up to the end of its period:
valueslists two parameters, or lists a text beside a parameter;- the object of the parameter has a key other than
parameter,at,of, andcalendar, or has noparameter; atis notstartorend;ofis notday,month, oryear;calendaris notbusiness;- it has
oforcalendarand noat; - it has
at: startwith an operator other thangte, orat: endwith an operator other thanlt.
of that is shorter than the period of the parameter, for example of: day on a month.
Joins
A join brings a table next to the rows of the query. Each item ofjoin has these keys:
With
left, each row of the query stays, and the brought columns are empty where no row pairs. With inner, the rows without a partner leave. A row with several partners becomes several rows.
A join is refused when:
- it names neither
tablenorquery, or names both; - it has no
match, ormatchhas no pair; - it writes
onin place ofmatch. Writematch; - it has a key other than
table,query,match,columns, andtype; - it brings a table and has no
columns, orcolumnshas no pair; - it brings a query and has
columns; - two joins of the query bring the same name, or a join brings a name that it also pairs on in
match; typeis notleftorinner.
Computed columns
compute adds a column to each row. The steps after it read it like a column of the table: filters, grouping, and sums.
A
case has these keys:
An answer is an object with exactly one key:
With
otherwise: refuse, a row whose value when does not list refuses the generation.
A computed column is refused when:
computehas two items with the sameas;- an item has a key other than
asandcase, or lacksasorcase; - the
casehas a key other thancolumn,when, andotherwise; columnorotherwiseis missing, orwhenis missing or empty;otherwiseis a text other thanrefuse;asis also a name that a join brings or a derive names, or thecasereads another computed column;- an answer does not have exactly one of
column,negate, andconstant, or its value is empty.
Grouping and measures
aggregate folds the rows into one row for each group.
A measure has these keys. All three are required:
A query that groups returns the
groupBy columns and one column for each measure. A field that reads another column is refused when you save. A generation is refused when a row has no value in a groupBy column.
aggregate is refused when it has a key other than groupBy and measures, or measures is missing or empty. A measure is refused when it has a key other than as, fn, and of, or lacks one of them. A generation refuses two measures with the same as.
Columns that a query returns
select names the columns that a query returns. Without it, the query returns each column and the fields choose. With it, a field that reads another column is refused when you save.
select is refused when the query also has aggregate, when it is empty, or when it names a column twice or names an empty column.
Lists inside documents
expand names a list inside each document, as a dotted path of the fields of the table. Each item of the list becomes a row. The query reads the fields of the item under the path of the list.
On a PostgreSQL data source, the answer of the save lists expand under unexecuted, and a generation is refused.
expand is refused when the path is empty, starts or ends with a dot, has two dots in a row, or has a space or a $. It is also refused on a query that has from.
Constructs that a generation refuses
Reporter reads and stores these constructs. The answer of the save lists them underunsupported. A generation of a mapping that holds one is refused.
Sets
Each key of
datasets is the name of a set that the contract declares. Its value has these keys:
An open set has one row for each row of its query. Reporter sorts the rows by the key fields of the set, as text in byte order. Without
from, the set has no query rows. If the contract declares the set as one row, its constants and parameters fill that row. When the contract declares a hierarchy for the code of the set, Reporter also adds a row for each ancestor code, with the sum of the rows beneath it. Return the amount posted to each code. Do not return a parent amount that already includes its children, because Reporter adds the children to it.
The rows of a set that the catalog publishes are the published rows, one for each. The mapping gives their values:
- The queries of the set read only the rows whose
rowKeycolumn holds a published code. When the contract declares a hierarchy for the code, they read the rows whose code falls under a published code. Reporter leaves out a row with another code and does not refuse it. In an item ofalso, Reporter does not leave out a row with another code: it refuses the generation. - A result row fills the published row of its code. When the contract declares a hierarchy, it also fills each published row above that code. Such a published row reads the sum of the measures of the result rows at and below its code.
- With a hierarchy, return the amount posted to each code. Do not return a parent amount that already includes its children, because Reporter adds the children to it.
- A published row with no result row reads
0in a measure that a query fills. Its other query columns get no value. A required field that reads one refuses the generation. - Two result rows with the same code refuse the generation.
- A generation where no result row matches a published row is refused.
- its
fromis not an object with aquerykey; - it has a key other than
from,rowKey,parentMatch,fields, andalso; rowKeyorparentMatchhas no pair;- it has no
fields, orfieldsis empty; - its
fromnames a query that the mapping does not declare.
Fields
A field says where its value comes from. Write one source, or writebyRowClass.
Each origin needs one thing:
A field of the contract that the mapping does not name stays blank, and the answer lists it as a gap. Reporter refuses to approve a draft while a required field is blank.
A field source is refused when:
fromis missing, or is not one of the five origins;- it names a
queryand its origin is notquery; - the origin is
queryorrowSetand there is nocolumn; - the origin is
constantand there is novalue; - the origin is
parameterand there is noparameter; - the origin is
manualand there is neither avaluenor apendingReason; - the field has a key other than the keys in the table above;
- the
querythat it names is not declared by the mapping.
Sources that depend on the row
byRowClass is for a set whose rows the catalog publishes. Each case has when and the keys of a source. The first case whose when matches the published row gives the value. A row that no case matches gets no value from this field. The generation is refused when the contract requires the field.
when has two required keys: rowSet, the column of the published row, and equals, the value that it must have.
This field reads a balance for one class of row and a monthly total for the other. Each class reads its own query:
byRowClass is refused when the field also has a from of its own. A case is refused when it has no when, when when has a key other than rowSet and equals, when rowSet or equals is missing, or when it has a key other than when and the keys of a source.
Consolidation
also adds sources to a set. Each item maps the same set over another query, for example another database of the filing institution. Reporter does not limit the query of an item to the filing institution. The filters of that query must choose the rows of the filing institution. The contract of the document says how Reporter joins the rows of the sources, and which sets accept also.
An item has the keys from, rowKey, and fields. It has no parentMatch and no also. Its from is required. Its fields use the keys of the fields of a set. An item with no fields, or with empty fields, maps nothing, and each field it does not map is a gap.
Reporter refuses an item whose from is also the from of the set or of another item. It refuses an item that reads a query that the mapping of any set reads. It also refuses an item that maps a field that the set’s own mapping does not map. Give each item its own queries.
Manual overrides and declarations
Reporter checks these keys when you save the mapping, and stores them with it. Each item of
manualOverrides has these keys:
An item is refused when it has a key other than these three, or when
field or value is empty.
generatable, incompleteReason, and incompleteFields hold your declaration about the document:
generatablemust betrueorfalse.generatable: falseis refused whenincompleteReasonis missing.incompleteFieldsis refused when it lists a field andgeneratableis notfalse.
Checks against the contract
After the document is read, Reporter compares it with the contract of the pinned version. The save is refused when:

