Ultimate VCL

Um conjunto de ferramentas para criar infraestrutura de relatórios para aplicativos de negócios Delphi e desenvolvimento multiplataforma

v. 2025.2.1
What reports can Ultimate VCL do

Quais relatórios o Ultimate VCL pode fazer?

Praticamente qualquer: notas fiscais, relatórios financeiros, catálogos de produtos com suporte ao perfil de cores, cardápios de restaurantes, detalhes de vendas, questionários com formulários eletrônicos, passagens aéreas, contas de serviços públicos e muito mais. Se você tem dados que precisam ser visualmente compreensíveis, o FastReport é a solução perfeita para você.

Características e benefícios Ultimate VCL

Transportes
Salve relatórios preparados nos armazenamentos em nuvem: Google Drive, Next Cloud, Box, Dropbox em alguns cliques do mouse para entrega conveniente aos seus clientes
Acesso rápido ao relatório e estrutura de dados
Na árvore de relatórios e na árvore de propriedades, Você pode editar a estrutura, os parâmetros e os filtros do relatório, bem como as fontes de dados com estilos globais.
Componentes cliente-servidor
Crie relatórios diretamente na WEB usando componentes VCL FastReport padrão sem a necessidade de conectar o cliente diretamente ao servidor de banco de dados.
Arquitetura flexível e aberta
Se a funcionalidade do FastReport não for suficiente para você, você pode melhorá-la criando e conectando seus objetos (filtros de exportação, bancos de dados) aos seus relatórios.
Código fonte
Este conjunto de componentes inclui códigos-fonte FastReport. Máxima comodidade para empresas que desejam adaptar o código às suas necessidades.
Adições úteis
O Ultimate inclui sistemas para análise multidimensional: FastCube VCL e FMX, além do FastConverter .Plugin FP3 para exportação de relatórios em todos os formatos possíveis.
The template designer in your application

O designer de modelos em seu aplicativo

O editor moderno oferece muitas ferramentas para criar modelos de relatórios. A arquitetura flexível permite criar editores para objetos Novos e existentes. O designer de modelos pode ser integrado ao seu aplicativo. Oferecemos suporte à localização para mais de 30 idiomas.

Ultimate VCL é um gerador de relatórios orientado a banda com um rico conjunto de bandas para a criação de vários tipos de relatórios. Você pode coletar elementos comuns (título, Porão, detalhes da empresa, logotipos) em um relatório básico e herdá-los para outros relatórios. A função de relatórios aninhados é suportada.

Data processing

Processamento de dados

O Ultimate VCL suporta classificação e filtragem de dados, relações mestre-detalhe. Tudo é configurado com alguns cliques do mouse. É possível se conectar ao FireDAC, ADO, BDE, DBX, IBX e FIBPlus para acessar a maioria dos bancos de dados, inclusive Oracle.

O relatório pode conter dados de tabelas, consultas e Conexões de banco de dados. O Ultimate VCL tem um mecanismo de script que suporta PascalScript, C++ Script, BasicScript e JScript. Os relatórios podem incluir formulários de diálogo para solicitar parâmetros antes da criação. Os controles de diálogo permitem conectar dados e filtrá-los sem escrever código.

Componentes Cliente-Servidor

Crie relatórios diretamente na WEB usando a tecnologia cliente-servidor com ferramentas FastReport padrão, sem a necessidade de uma conexão direta com um servidor de banco de dados. Você pode gerenciar várias solicitações do cliente ao mesmo tempo em threads separados, minimizando assim o tempo de resposta do servidor.

O componente TfrxReportServer é um Servidor HTTP autônomo com a capacidade de criar relatórios. O servidor de relatórios pode criar vários relatórios simultaneamente, registrar eventos e coletar dados. Para usar as soluções já existentes baseadas em outros servidores HTTP, você pode integrá-las ao servidor FastReport com um mecanismo CGI. Os relatórios podem ser incorporados em um sistema já em funcionamento (site). Servidores HTTP e servidores de relatório podem trabalhar em computadores diferentes e usar criptografia SSL.

Printing reports

Configurações adicionais de impressão

As seguintes opções estão disponíveis para você: cortar páginas de relatório grandes em pequenas, imprimir várias páginas pequenas em uma grande e imprimir em um formato predefinido com escala.

Você precisa imprimir um relatório contendo páginas A3 em uma impressora A4 comum? Agora não tem problema!

Preview and print

Visualizar e imprimir

O relatório pré-preparado pode ser examinado em detalhes na janela de visualização do Visualizador de relatórios. Nosso componente suporta o trabalho com parâmetros, detalhamento em vários níveis e relatórios interativos.

Você pode definir uma resposta a um clique do mouse em um objeto na janela de visualização. Por exemplo, você pode criar e exibir outro relatório que mostre informações detalhadas sobre o objeto em que o usuário clicou.

Exports to convenient formats

Exporta para formatos convenientes

Filtros para exportar o relatório finalizado para vários formatos: PDF, RTF, XLSX, XML, DOCX, TXT, CSV, Excel OLE, PowerPoint, HTML, MHT, XPS, JPEG, BMP, PNG, Open Document Format (ODT, ODS, ODP), XAML, Scalable Vector Graphics (SVG), ZPL, etc.

O Ultimate VCL permite converter rapidamente relatórios com campos editáveis (como campos de texto, caixas de combinação, caixas de seleção, botões de opção e campos gráficos) em documentos PDF sem conectar bibliotecas adicionais. Salve seus relatórios em formatos populares: PDF 1.4-1.7, PDF/A-1a, PDF/A-1b, PDF/A-2A, PDF/A-2b, PDF/A-3a, PDF/a-3b, que são seguros, acessíveis e confiáveis.

Cross-platform developing

Com a ajuda dos componentes FastReport FMX e FastCube FMX incluídos no Ultimate VCL, é possível desenvolver aplicativos de relatórios multiplataforma para Windows, macOS e Linux. Isso permite que os desenvolvedores criem documentos que serão executados em diferentes sistemas operacionais sem a necessidade de configuração ou recompilação adicional.

Graças ao ambiente FireMonkey compatível com o Embarcadero RAD Studio, a criação de projetos para várias resoluções de tela e tamanhos de dispositivos é suportada, garantindo a adaptabilidade dos aplicativos em todos os dispositivos.

Os usuários em diferentes sistemas operacionais podem trabalhar com seu aplicativo sem precisar instalar bibliotecas ou componentes adicionais. Isso simplifica o processo de distribuição e manutenção do aplicativo.

FastScript formulas

Fórmulas FastScript

No Ultimate VCL, o FastScript pacote é usado para realizar cálculos não padronizados. Usando scripts, você pode calcular indicadores e filtros. Você pode definir o processamento de dados após ou simultaneamente com indicadores padrão.

Para indicadores, você pode definir filtros especificados pelo script. Esse filtro é usado se for necessário calcular indicadores não para todas as linhas do conjunto de dados original, mas apenas para as selecionadas. O filtro de cálculo pode ser aplicado a ambas as medidas com base em funções de agregação padrão e medidas calculadas.

Transports

Transportes

Ultimate VCL permite exportar os relatórios preparados e exportar resultados para diferentes armazenamentos em nuvem, como FTP, Dropbox, OneDrive, Google Drive, Box.com, e outros. Ele simplifica os processos de salvamento de relatórios e os disponibiliza para outros usuários a qualquer hora e lugar.

Os Serviços em nuvem permitem backups automáticos de arquivos, o que reduz o risco de perda de dados em caso de mau funcionamento do equipamento ou outras situações de emergência. Armazenar arquivos na nuvem abre espaço para armazenamento local, o que é útil para usuários com espaço limitado em um disco rígido ou SSD.

FastQueryBuilder

FastQueryBuilder

Crie consultas de banco de dados com conhecimento de SQL! Você pode usar * * FastQueryBuilder** em suas aplicações escritas em Embarcadero Delphi, C++ Builder, RAD Studio (VCL e FMX - FireMonkey), e Lazarus para criação de um gerador SQL simples. Modelos visuais da solicitação são mantidos para posterior uso e edição.

O FastQueryBuilder permite trabalhar com bancos de dados locais e cliente-servidor usando BDE, ADO, IBX e FIBPlus. Uma parametrização visual completa das requisições pode ser construída em qualquer janela da sua aplicação.

OLAP components

Componentes OLAP

O Ultimate VCL inclui componentes de tabela cruzada para VCL e FMX, uma ferramenta interativa para apresentação de dados e processamento analítico. A parte central da tabela exibe os valores dos indicadores.

A tabela cruzada consiste em muitas áreas: o cabeçalho da tabela cruzada, a área dos campos de filtro, os cabeçalhos vertical e horizontal das dimensões, o cabeçalho vertical e horizontal da tabela cruzada, a área de dados, a lista de Campos, a lista de filtros Top-N, A área de cálculos agregados para as células selecionadas e controle de escala.

Opções de entrega

Características
de R$ 8.299
de R$ 4.399
de R$ 3.299
de R$ 4.399
de R$ 4.399
de R$ 2.699
FastReport Engine
VCL components
FMX components
Lazarus components
OLAP features
OLAP aggregation functions
Data connections
Reporting features
Report objects
Barcodes
Charts
Printing
Export in formats
Source Code
Convertors from
Transports

Artigos reenviados

24 de abril de 2025

How to Open and Convert an FP3 File Using the FastConverter .FP3

FP3 is a format for ready-made reports generated using FastReport report generators, integrated into various business applications. A file in this format can be generated by different programs, such as CRM or ERP. To easily convert it to any preferred format, use the FastConverter .FP3. It allows you to convert .fp3 files to PDF formats versions 1.4, 1.5, 1.6, and 1.7, PDF/A (1, 2, 3), RTF, XLSX, XML, DOCX, TXT, CSV, PPTX, HTML, JPEG, BMP, PNG, TIFF, EMF, SVG, Open Document Format (ODT, ODS, ODP), and more. Both single file conversion and batch conversion are possible.     How to Convert a File from .fp3 to PDF Step 1: Install FastConverter .FP3. You need to download and install FastConverter .FP3 using this link. After installation, launch the program.   Step 2: Opening an FP3 file. Go to the "File" menu → "Open," then select an FP3 format file and click "Open."   Step 3: Converting FP3 to another format. After loading the file, click "File" → "Save As." A wide variety of supported formats for exporting the document will become available to you. In the "Target Format" field, select the desired format (PDF, DOCX, XLSX, HTML, PNG, etc.) from the list provided.   Step 4: Final file location and name. Specify the folder and file name for saving in the "Target File" field and click "Save." After the conversion is complete, the file will be available in the specified directory in the new format.   For any questions, please contact our support team at support@fast-report.com.
Ler
22 de abril de 2025

Working with the TfrShellTreeView Component in FastReport VCL

FastReport isn’t just about report components—it has a lot more to offer! In particular, there are several components that you can use in your applications just like the other Delphi components, and we’re always adding more to the library. In this article, we’ll check out one of these: TfrShellTreeView. This component is designed to display elements of the file system and is partially equivalent to components such as TDirectoryListBox, TDirectoryOutline in Delphi, and TShellTreeView in Lazarus. If you want to see how it looks without launching the IDE, that’s the "tree" you see on the left in the explorer window.   This component works great in Windows and Linux, for both Delphi and Lazarus. It doesn’t support FMX development. TfrShellTreeView leverages a lot of operating system features. For instance, in Windows, you can treat zip archives like regular folders and even mess with their contents—extracting and adding files. Some features might not be available in Linux, depending on which version you’re running. But don’t worry: showing the tree and selecting elements will always work on any OS. The main property of TfrShellTreeView that manages interaction with the operating system is OptionsShell.   ContextMenu — specifies whether to show the system context menu for the selected file. ShowFolder — this property displays folders. ShowHidden — this property indicates whether hidden files will be visible or not. ShowNonFolders — this property displays regular files (not folders). TrackShellChanges — this property is designed to monitor changes in the file system. If you have any folder open in the component and it gets modified (for instance, if you copy a file into it), a new node representing that file will be automatically added to the component. TfrShellTreeView supports a set of hotkeys specific to the standard file dialog or Explorer in Windows (Ctrl+С, Ctrl+V, Delete, etc.) with standard dialogs. Also, the TfrShellTreeView component supports Drag&Drop of file system elements both within itself and from other (but not all) file managers. The OptionsBehavior.AllowDragDrop property is used to allow Drag&Drop operations. Dragging is carried out using operating system functions. The remaining properties are similar to those in the TTreeView and TfrTreeView components. However, it is worth noting that they are grouped by type of use: OptionsBehavior, OptionsSelection, OptionsShell, OptionsView. This will allow you to quickly find the properties you need. As mentioned above, the component is designed to display the computer’s file system. By default, the component is configured to display the root folder of your system: "Desktop" in Windows or "/" in Linux. However, the capabilities of the component are not limited to this.  Let’s place the TfrShellTreeView component on the form and open its editor:   The TfrShellTreeView editor looks similar to the editors of the TTreeView and TfrTreeView components, but it has 2 new buttons: New shell Root Item. New shell Root SubItem. As we can see in the editor screenshot, the component can contain: Regular nodes, containing only text, such as "New simple item 1". Nodes with a location in the file system, such as "This Computer", "Lazarus", "data". We will refer to such nodes as shell nodes. Regular and child nodes are created and edited in the same way as in regular TreeViews. Nodes that have a link to a file structure element are created using the "New shell Root Item" buttons. This will create a shell node of the same level as the current one. If you click on "New shell Root SubItem", a child shell node will be created in relation to the current node. Please note that you cannot create child nodes for a shell node, but you can for a regular node.  Editing shell nodes comes down to specifying which folder the given node is linked to. You can set the binding to a folder using constants of the TfrRootNodes type. These constants define places such as the desktop, autostart, and so on. If you set the rfCustomPath constant, it becomes possible to add a path to the file system folder in the directory tree below. You can also set this path using the editing window located below the directory tree. For example, the screenshot below sets the path to the Lazarus folder located on drive C:\.   Like a regular TreeView, regular nodes of the component can be assigned icons. Shell nodes cannot be assigned icons; they use icons set in the operating system. For nodes, the icon index added in the ImageIndex property is actually used. The remaining icon indexes are not used. Also, due to the peculiarities of using the component, some other properties are not implemented. For example, there is no possibility of multiple selection of elements. The most frequently used property is, of course, TfrShellTreeView.SelectedPath. If a shell node is selected, then this property contains the path to the folder to which this node points. Otherwise, this property is equal to an empty string. In addition, working with the component is also available programmatically. You can add a regular (non-shell) node in the same ways as a regular TTreeView. frShellTreeView1.Items.Add(nil,Edit1.Text); //add a root node with text from Edit1 Adding a node to the currently selected node: procedure TForm1.Button5Click(Sender: TObject); var N:TfrShellTreeViewNode; begin N:=(frShellTreeView1.Selected) as TfrShellTreeViewNode; if N=nil then Exit; frShellTreeView1.Items.AddChild(N,Edit1.Text); end; Removing a node is also easy. For example, this is how the currently selected node is removed: procedure TForm1.Button2Click(Sender: TObject); var N:TfrShellTreeViewNode; begin N:=(frShellTreeView1.Selected) as TfrShellTreeViewNode; if N=nil then exit; frShellTreeView1.Items.Delete(N); end; However, to remove a node, you can simply call its Free method. Unfortunately, the component currently does not support generating events that occur when the file system folders associated with it change. The rest of the component’s functionality largely coincides with the standard TreeView. In conclusion, FastReport is not only a tool for creating reports, but also a source of additional components that can be used in Delphi applications. TfrShellTreeView provides a convenient way to display file system elements and can be useful in various projects. The FastReport component library is constantly updated, which makes this tool even more attractive to developers.
Ler
22 de abril de 2025

Working with XML and JSON Formats in FastScript

Currently, XML and JSON formats have emerged as the primary standards for data storage and information exchange between computer systems. At the request of users, classes for handling XML and JSON have been added to FastScript. In this article, we’ll take a closer look at how to work with these classes, explore their properties and methods, and also create reports from code using scripts.     XML Format To work with XML in scripts, 2 classes are used. These classes are focused on maximum speed and low memory consumption.   TfrXMLDocument – a class that encapsulates the functionality of an XML document. The following properties and methods are available in it. Class Properties and Methods Description procedure SaveToStream(Stream: TStream); Saves the XML to the passed stream. procedure LoadFromStream(Stream: TStream; AllowPartialLoading: Boolean = False); Loads the XML from the passed stream. procedure SaveToFile(const FileName: string); Saves the XML to a file with the specified name. procedure LoadFromFile(const FileName: string); Loads the XML from a file with the specified name. procedure Clear; Deletes all XML nodes from the tree, except the root node. The content of the node is NOT cleared. property Root: TfrXMLItem; Allows access to the root element of the tree. property AsText: string; Allows you to both get and set the XML as a string (for example, using this property, you can pass the XML to the report script using a report variable). property AutoIndent: Boolean; Determines how the output XML will be generated: as a single line or as indented text.   TfrXMLNode – a class that encapsulates the properties of an XML document node. You cannot create an object of this type directly. It is created by calling the Add() method of the element to which you want to add a child element. Let’s take a closer look at the properties and methods of the TfrXMLNode class. Class Properties and Methods Description function Add(AName:string):TfrXMLItem; Creates a child TfrXMLItem with the specified name and returns it. procedure Clear; Clears the list of child elements. procedure InsertItem(Index:integer; AItem: TfrXMLItem); Inserts a child element into the specified position. The element may belong to another document. function Find(AName:string):Integer; Searches the child elements for a TfrXMLItem with the specified name and returns it. If the element is not found, -1 is returned. If there are several elements with the specified name, the first one is returned. function FindItem(AName:string):TfrXMLItem; Searches the child elements for a TfrXMLItem with the specified name and returns it. If the element is not found, a new element with the specified name is created and returned. If there are several elements with the specified name, the first one is returned. function Root: TfrXMLItem; Returns the root element of the document. property Count:Integer; Returns the number of child nodes of the element. property Items[AIndex:Integer]: TfrXMLItem; Returns a child element by its index. property Prop[AName:string]:string; Returns or sets the value of the node’s attribute with the specified name. property Name: string; The tag name of the element. property Parent: TfrXMLItem; The name of the parent element. Root is nil. property Text:string; A string containing a list of node parameters in the format Name1="Value1" Name2="Value2"… Special characters in this string are quoted. procedure Delete(AIndex: Integer); Deletes a child element with AIndex. procedure DeleteProp(const APropName: string); Deletes the node’s attribute with the specified name. property Value: string; The text that is located between the opening and closing tag of the element. function PropExists(APropName:string):Boolean; Helps to determine whether an element has an attribute with the specified name. function IndexOf(AItem: TfrXMLItem):Integer; Returns the index of the passed element. function GetPropNames(ANames:TStrings); Fills the passed list of strings with the names of the TfrXMLItem attributes.   Let’s try to build a report using classes for working with XML. For example, we will display data from the "country.xml" file in the report, but we will not use TClientDataSet, and will use direct access to the XML file. We create a new report, go to the editing mode, put MasterData on the report. And add several Memo on top to display the data. We will also create an OnBeforePrint event for the MasterData object. The final report script code will look like this: var doc: TfrXMLDocument; item: TfrXMLItem; IIndex: Integer;   procedure MasterData1OnBeforePrint(Sender: TfrxComponent); var cur: TfrXMLItem; S: string; begin cur := item[IIndex]; mmNum.Text := cur.Prop['Code']; mmName.Text := cur.Prop['Name']; mmCapital.Text := cur.Prop['Capital']; mmArea.Text := cur.Prop['Area']; mmPopulation.Text := cur.Prop['Population']; mmContinent.Text := cur.Prop['Continent']; Inc(IIndex); end;   begin Doc := TfrXMLDocument.Create; Doc.LoadFromFile('..\..\Data\country.xml'); item := Doc.Root[1]; IIndex := 0; MasterData1.RowCount := item.count; end. Let’s go ahead and run the report. To make it easier to read, we’ve also added column headers.     JSON Format Let’s smoothly transition from XML to JSON format. To work with it in FastReport, 2 classes are also used—TfrJSON and TfrJSONArray. In this case, these classes are simply a wrapper around classes from System.JSON in the Delphi platform or similar classes in Lazarus.   TfrJSONObject — a class that encapsulates functions for working with JSON objects. Class Properties and Methods Description function Create(const JSONstring: string); Creates a JSON object and populates it from the provided string. function IsValid:Boolean; Returns True if the object contains valid JSON. procedure LodFromFile(const AFilName:string); Loads data from the specified file. If the object contains data, it will be lost. procedure LoadFromtStream(const AStream:TStream); Loads data from the provided stream. If the object contains data, it will be lost. function ToString:string;   Returns a string containing the textual representation of the JSON object. procedure SaveToFile(const AFileName: string); Saves the textual representation of the JSON object to a file. procedure SaveToStream(AStream: TStream Saves the textual representation of the JSON object to a stream. function IsNameExists(const AName:string); Returns True if the object has a property with the specified name. function IsNameValueExists(const Name, Value: string): boolean; Returns True if the object has a property with the specified name and its value matches the specified value. function Count:Integer; Returns the total number of properties in the JSON object. property Names[AIndex:Integer]:string; Returns the name of the property at the specified index. Property ValueType[IndexOrName:Variant]:TfrJSONType; Returns the type of the property at the specified index or name. The type can be one of the following values:- jsUnknown–—The type of the property is unknown (a parsing error occurred or a property with such an index or name is missing). - jsNumber—The property has a numeric type. - jsString—The property has a string type. - jsBoolean—The property has a boolean type (true/false). - jsNull—The type of the property is null (no value is assigned). - jsList—The type of the property is a JSON array. - jsObject—The type of the property is a nested JSON object. The properties below allow you to retrieve the values of the JSON object in one form or another. In all these properties, indexing is performed either by the property number in the list of properties or by its name. Note that AsString[‘1’] <> AsString[1]. Also, if you try to get the value of a property using an inappropriate method, errors may occur and incorrect property values may be returned. For example, if a property has the type "Object" or "Array", then when you try to get its value using the AsString property, you will get an empty string. In other cases, AsString will return the string representation of the property’s value. Class Properties and Methods Description property AsObject[IndexOrName: Variant]: TfrxJSON; Allows you to retrieve a nested JSON object. property AsArray[IndexOrName: Variant]: TfrJSONArray; Allows you to retrieve a nested JSON array. Property AsString[IndexOrName: Variant]: string; Allows you to retrieve the value of a property as a string. This retrieval method can be applied to properties of other types, except for objects and arrays. For boolean values, a string containing the value "True" or "False" will be returned. For numbers with a fractional part, a dot will always be used as the fractional part separator, regardless of regional settings. property AsNumber[IndexOrName: Variant]: Extended; Allows you to retrieve the value of a property as a number. If the property has a non-numeric type, 0 will be returned. property AsBoolean[IndexOrName: Variant]: Boolean; Allows you to retrieve the value of a property as a boolean value. If the property has another type, False will be returned. To return a field of type null, you’ll have to put in a little effort. There isn’t a dedicated method for that. However, you can use the ValueType property, which returns jsNull for a field of type null, or use the AsString property, which returns the string ‘null’. Let’s take a closer look at the methods for manipulating object properties. Class Methods Description Procedure Delete(AName: String);   Removes a property with the specified name from the object. function AddObject(const AName: string): Integer Adds a child empty object with the specified name to the object. function AddArray(const AName: string): Integer; Adds an empty array with the specified name to the object. function AddString(const AName, AValue: string): Integer; Adds a string with the specified name to the object. function AddBool(const AName: string; AValue: boolean): Integer; Adds a boolean value with the specified name to the object. function AddNumber(const AName: string; AValue:Extended): Integer; Adds a numeric real value with the specified name to the object. function AddInteger(const AName: string; AValue:Integer): Integer; Adds a numeric integer value with the specified name to the object. function AddNull(const AName: string): Integer; Adds a null value with the specified name to the object. The methods return an integer, which is the index of the added element in the list of all fields. All methods that add fields to the object do not control the presence of existing fields with the same names. This procedure is the responsibility of the programmer using this class. Such control is necessary to prevent the appearance of multiple fields with the same names in the output JSON. The behavior of the system in this case is undefined—it depends on the parser that will further parse the received JSON. This means that any of the values with the same names may be used! The TJSONArray class encapsulates methods and properties for working with JSON arrays. In principle, the main properties are the same, but you can only access them by index. Only operations to access any element, get its value, or delete any element are supported. You cannot move elements in the array or change their type. Let’s consider the properties and methods for obtaining the values of elements in this class. Class Properties and Methods Description function Count:Integer; Returns the number of elements in the array. property ValueType[AIndex: Integer]: TfrJSONType; Returns the type of the array element with the specified index. property AsObject[AIndex: Integer]: TfrJSONObject; Returns an object providing access to the array element as a JSON object. Property AsArray[AIndex: Integer]: TfrJSONArray Returns an object providing access to the array element as a JSON array. property AsString[AIndex: Integer]: string; Returns the value of the array element as a string. property AsNumber[AIndex: Integer]: Extended; Returns the value of the array element as a number. property AsBoolean[AIndex: Integer]: Boolean; Returns the value of the array element as a boolean value. When dealing with arrays, like with objects, you need to carefully approach extracting the values of elements. Depending on the type of the value, you should use the appropriate method to retrieve it. The methods for manipulating elements of a JSON array are described below. Class Properties and Methods Description procedure Delete(AIndex:Integer); Deletes an array element at the specified index. function AddObject: Integer; Adds a nested JSON object to the end of the array. function AddArray: Integer; Adds a nested JSON array to the end of the array. function AddString(const AValue: string): Integer; Adds a string to the end of the array. function AddBool(AValue: boolean): Integer; Adds a boolean value to the end of the array. function AddNumber(AValue:Extended): Integer; Adds a floating-point number to the end of the array. function AddInteger(AValue: Integer): Integer; Adds an integer to the end of the array. function AddNull: Integer; Adds null to the end of the array. All of these methods return the position of the element added to the array. You cannot insert an element into the middle of the array; this is a limitation of the base classes in System.JSON.     Specifics of Using Classes to Access JSON When using objects, it’s important to remember that after using wrapper objects, you must remove all of them from the code. Note that if you want to get a child object or array, but instead there’s a scalar value or no value at all, the property will return nil, and an exception will occur when accessing that property further. Avoid using methods that are not intended to work with values of specific types stored in an element to retrieve those values. It’s important to note that property names of objects are case-sensitive, meaning "Item1" and "item1" are considered different names! You can only set values for object elements if the type of those values matches the type that is defined for the element. If you need to redefine the type of an element, delete it and add a new one with the same name and the type you want. Entering new values for array elements is not possible. You need to delete the JSON array and then recreate it with the values you want. Let’s use the classes from the description above and write a script that extracts data (without type information) from an XML file and puts it into a JSON object. procedure XMLToJSON; var XML: TfrXMLDocument; xi, xi1: TfrXMLItem; I, J: Integer; JO: TfrJSONObject; JA, JA1: TfrJSONArray; SL: TStringList; begin XML:=TfrXMLDocument.Create; XML.LoadFromFile('.\..\..\data\country.xml'); JO:=TfrJSONObject.Create('{}'); JO.AddArray('data'); JA:=JO.AsArray['data']; xi:=X.Root[1]; xi1:=xi.Items[0]; SL:=TStringList.Create; xi1.GetParamNames(SL); for I:=0 to xi.Count - 1 do begin xi1:=xi.Items[I]; JA1:=JA.AsArray[JA.AddArray]; for J:=0 to SL.Count-1 do JA1.AddString(xi1.Prop[SL[J]]); JA1.Free; end; JA.Free; JO.SaveToFile('.\..\..\data\country.json'); JO.Free; SL.Free; end; And let’s try to build a report based on the obtained data (first, place the appropriate MasterData and Memo components on the report page): var J:TfrJSONObject; A:TfrJSONArray; curr:Integer;   procedure MasterData1OnBeforePrint(Sender: TfrxComponent); var A1:TfrJSONArray; begin A1:=A.AsArray(curr); Memo1.Memo.Text:=A1.AsString[0]; Memo2.Memo.Text:=A1.AsString[1]; Memo3.Memo.Text:=A1.AsString[2]; Memo4.Memo.Text:=A1.AsString[3]; Memo5.Memo.Text:=A1.AsString[4]; Memo6.Memo.Text:=A1.AsString[5]; A1.Free; curr := curr + 1; end;   begin J:=TfrJSONObject.Create(''); J.LoadFromFile('.\..\..\data\country.json'); A:=J.AsArray[0]; MasterData1.RowCount:=A.Count; curr:=0; end.   You can also use these objects in Delphi code—simply include the frXML and frJSON modules in the uses statement.     Conclusion In this article, we explored the use of classes for working with JSON and XML in FastReport. If you’re a developer working not just with reports but also with Delphi and Lazarus, utilizing these classes will help minimize issues when switching between environments—your experience will be consistent across both IDEs. For your convenience, we’ve included two examples in this article demonstrating report generation using XML and JSON. You can open and run these examples directly in FastReportDemo, which comes with the FastReport distribution. You might need to configure the reports before running them—just make sure to specify the correct path to the data file "country.xml," which can be found both in the DemoCenter and in the folder with the examples. Download Examples
Ler
Fast Reports
  • 800-985-8986 (English, US)
  • +31 97 01025-8466 (English, EU)
  • +49 30 56837-3928 (German, DE)
  • +55 19 98147-8148 (Portuguese, BR)
  • info@fast-report.com
  • 66 Canal Center Plaza, Ste 505, Alexandria, VA 22314

© 1998-2025 Fast Reports Inc.