# Structure

There are three major parts of a report: Data structure, Data binding and Report layout.

## Data Structure

All ported reports always have two tables: *InputItems* and *ReportVariables*. The tables are linked by a unique progressive ID column named \_ReportVariablesRowId. All the input items from the original report are generated as fields in the *InputItems* table, while all the report variables are fields in the *ReportVariables* table.

## Data binding

At runtime, the PPJ Framework takes care of building a DataSet by generating and handling all the *SAM\_Report*\* events in the correct order. The dataset is then passed to the CR.NET module to print the report. While generating the data set, the value \_ReportVariablesRowId is increased every time a new report variable is assigned. We have a one-to-many relationship between the *ReportVariable* table and the *InputItems* table because report variables usually change only a handful of times in a typical report and would be a big waste of memory to repeat the same row for each *InputItem* row.

## Report layout

Report Builder reports are separated in the usual sections. However, each section is separated in old fashioned lines. While porting, we try to consolidate lines into the same report section in Crystal Report. Only when a line needs to grow or has different properties compared to the next line, we generate a new section in CR.

Linked fields in Report Builder are ported as subfields in a larger text field in CR.

All report formulas are ported with vert minimal transformations. We try to use CR built-in functions when possible. We have implemented the following unsupported functions are new methods at the report level:

* DateAddDay
* DateIFF
* DateMonthBegin
* DateMonthEnd
* DateToStr
* NumberIFF
* Power
* StrCase
* StrMid
* StrPad
* StrReplace
* StrTranslate


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.iceteagroup.com/general/ported-reports/crystal-reports/structure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
