📜 ⬆️ ⬇️

ActivityManager report generator. Another bike, but in profile

ActivityManager is a report generation manager based on the replacement of template lines.
The main features of the ActivityManager are:


Report configuration using ActivityManager can be divided into 3 parts: the selection of data, their processing and the formation of the report itself. Detailed information on each of the stages, see the relevant sections.

Glossary



Configuration File Structure


The report configuration file is a regular xml file of the following type:

Example
<?xml version="1.0" encoding="utf-8"?> <activity> <plugins> <include>ConvertModule.dll</include> ... </plugins> <language>ru</language> <step plugin="SqlDataSource" action="SqlSetConnectionString" repeat="1"> <input> <parameter name="connectionString">dsn=registry</parameter> </input> </step> <step plugin="SqlDataSource" action="SqlSelectTable" repeat="1"> <input> <parameter name="query">SELECT * FROM executors;</parameter> </input> <output> <parameter name="table">new_table</parameter> </output> </step> ... </activity> 


The main part of the report configuration file is occupied by steps. The steps are essentially the stages of generating a report: data sampling, data processing, report configuration, data source and much more. A step consists of the name of the plugin plugin, which contains the action action that needs to be performed, input <input /> and output <output /> parameters and the repeat parameter indicating how many times this step must be performed (default 1). Each input parameter has the name name and value (content). Each output parameter has a name by default name <and redefinition of the name (content). Using this parameter name in subsequent steps of report generation, you can get its value from the global parameters collection. For more information about the collection of global parameters, see the "Parameter Passing" section.
')
At the top of the configuration file is a <plugins /> block. In this block is a list of downloadable plug-ins during execution. The default plugins are located in the plugins \ directory. The <language /> block indicates the language in which messages will be displayed (mostly errors) during report generation. Currently two languages ​​are supported: Russian and English. Language translations are located in the lang \ directory.
Despite the simple structure of the configuration file, editing it manually is tedious. Therefore, a special configuration file editor was developed. Read more in the "Visual File Editor" section.

Supplied Plugins


In the default delivery of ActivityManager, there are 6 basic and one custom plugin:


Parameter passing


Command line parameters


When launching the report generation to the core (ActivityManager.exe), you must pass one required config parameter in the form

 ActivityManager.exe config="c:\1.xml" 

As a result, ActivityManager.exe will read the configuration file located along the path c: \ 1.xml and generate a report.
In addition to the required config parameter of the ActivityManager, you can also pass the lang parameter, the language of the messages displayed during execution (for the most part, errors that occurred when generating the report).

In addition to the basic config and lang parameters , the ActivityManager can accept any number of any other parameters that will be placed in the collection of global runtime parameters and can be used during report generation. For example:

 ActivityManager.exe config="c:\1.xml" connectionString="dsn=registry" id_process=318 

As a result of executing this command, connectionString and id_process parameters will fall into the collection of global runtime parameters and can be used during connection setup with a data source, a sample and at any other report step. How exactly to use these parameters during execution, see in the next section.

Global runtime options


The collection of global runtime parameters is a list of named variables that can be used at any step of the report generation (provided that at this step, the parameter is already available).
Parameters are written to this collection in two cases:


To use global parameters, you must enclose the name of the parameter in square brackets. Before transmitting the parameter value to execution, the preprocessor will check the compliance of the template with square brackets with the parameters in the collection, and if it finds a match by name, it will make a replacement.
For example, suppose we run the report generation as follows.

 ActivityManager.exe config="c:\1.xml" connectionString="dsn=registry" id_process=318 

Then during the execution of the application, we can use the command line arguments passed as follows:

Example
 <step plugin="SqlDataSource" action="SqlSetConnectionString" repeat="1"> <input> <parameter name="connectionString">[connectionString]</parameter> </input> </step> <step plugin="SqlDataSource" action="SqlSelectTable" repeat="1"> <input> <parameter name="query">SELECT * FROM tenancy_processes WHERE id_process = [id_process]</parameter> </input> <output> <parameter name="table">tenancy_processes</parameter> </output> </step> <step plugin="ReportModule" action="ReportSetTableValue" repeat="1"> <input> <parameter name="table">[tenancy_processes]</parameter> <parameter name="xmlContractor">Row</parameter> </input> </step> <step plugin="ReportModule" action="ReportGenerate" repeat="1"> <output> <parameter name="fileName"></parameter> </output> </step> 


As you can see, in the first step, the SqlSetConnectionString (setting the connection string) in the input parameter indicates [connectionString], which tells the preprocessor to take this parameter from the global parameters collection. In case the parameter in square brackets is not found in the collection of global parameters, no error messages will be generated. ActivityManager will understand that this string is not a parameter and will leave it unchanged.

Note the output parameter of the step SqlSelectTable

 <output> <parameter name="table">tenancy_processes</parameter> </output> 

This entry means that after the execution of the request, the data from the source will be stored in the global parameter area under the name tenancy_processes and can be accessed via [tenancy_processes] (which is done in the next step ReportSetTableValue)

 <input> <parameter name="table">[tenancy_processes]</parameter> <parameter name="xmlContractor">Row</parameter> </input> 

Parameters of simple types (strings, numbers, dates, etc., namely all types that can be uniquely converted from the System.String type to the target type using Convert.ChangeType) are replaced in substitution mode. Those. It is perfectly possible to set the parameter as part of the value, and not as an integer. For example:

 <input> <parameter name="query">SELECT * FROM tenancy_processes WHERE id_process = [id_process]</parameter> </input> 

Parameters of more complex types that cannot be unambiguously converted from a string representation will be substituted directly. In such parameters, partial substitution is impossible by definition.

Parameter substitution from the global collection is performed only in the input action parameters.

Data retrieval


Before you generate a report, you must obtain data. At the moment, data sources for ActivityManager can be DBMS, for which there is a .Net-provider, as well as text files in CSV format. Unfortunately, there is no native data source for XML yet.

The result of sampling data from any of the described sources will be an object of either a scalar type or a ReportTable type.

SQL data sources


The plugin SqlDataSource.dll is intended for working with SQL data sources.
A simple example of using this plugin to fetch data from an ODBC data source:

Example
 <step plugin="SqlDataSource" action="SqlSetConnectionString" repeat="1"> <input> <parameter name="connectionString">dsn=registry</parameter> </input> </step> <step plugin="SqlDataSource" action="SqlSelectTable" repeat="1"> <input> <parameter name="query">SELECT * FROM executors;</parameter> </input> <output> <parameter name="table">new_table</parameter> </output> </step> 


In the first step of this example, the connection string is set. The second is a selection of data from the executors table, the data is written into a table with the name new_table. After which we can make various modifications to them via the ConvertModule.dll plugin or send directly to the report.
ODBC is used as the default provider in the SqlDataSource, but it is allowed to install any provider supported in .Net. To install the provider, use the SqlSetProvider function. For example, you can install an OLE DB provider like this:

 <step plugin="SqlDataSource" action="SqlSetProvider" repeat="1"> <input> <parameter name="name">OLE</parameter> </input> </step> 

Here, the name parameter is the full or short invariant name of the provider. There is no need to specify the full invariant name, since Name matching is not clear (by pattern). For example, instead of the full invariant name for MS Sql Server (System.Data.SqlClient), you can simply specify:

 <step plugin="SqlDataSource" action="SqlSetProvider" repeat="1"> <input> <parameter name="name">SQL</parameter> </input> </step> 

or for example

 <step plugin="SqlDataSource" action="SqlSetProvider" repeat="1"> <input> <parameter name="name">SqlClient</parameter> </input> </step> 

The full list of supported providers depends on the machine on which the report is generated and can be obtained through the DbProviderFactories.GetFactoryClasses () method.
In addition to the SqlSetProvider and SqlSelectTable actions, the SqlDataSource plugin has 8 more actions. A full list of them can be found on the project wiki.

CSV data sources


In addition to working with the DBMS, ActivityManager supports the selection and modification of data from CSV files. For sampling data from CSV files, in addition to Microsoft Text Driver, through ODBC, the ability to sample by the built-in text driver based on MySQL syntax is supported.
For example, suppose we have two CSV files users.csv and user_actions.csv with the following content:
users.csv:

 id|surname|name|patronymic 1||| 2||| 

user_actions.csv:

 id_user|action 1|1 1|2 1|3 2|4 

We need to choose the number of actions for each user.
The configuration of the data sampling step from the CSV will look like this:

Example
 <step plugin="TextDataSource" action="TextSelectTable" repeat="1"> <input> <parameter name="query"> SELECT a.surname, a.name, a.patronymic, COUNT(*) AS record_count FROM [csv_path]users.csv a LEFT JOIN [csv_path]user_actions.csv b ON a.id = b.id_user GROUP BY a.id </parameter> <parameter name="columnSeparator">|</parameter> <parameter name="rowSeparator"></parameter> <parameter name="firstRowHeader">true</parameter> <parameter name="ignoreDataTypes">true</parameter> </input> <output> <parameter name="table"></parameter> </output> </step> 


The result of this query will be stored in the global parameters collection under the name table.
In addition to the TextSelectTable action, there are 2 more actions in the TextDataSource plugin: TextSelectScalar and TextModifyQuery, detailed information about which you can also find on the project wiki .

Data conversion


Often there is a need to format the data after sampling from the source and before they are written to the final report. The reasons for this can be many, from the lack of support at the DBMS level of any complex transformations, to the reluctance to "dirty" a SQL query with a mass of excessive conditions that turn it into an unreadable sheet.
For such data transformations in ActivityManager, the plugin ConvertModule.dll is used.
Here is a list of what can be done with the data using this plugin:


Consider the data format conversion functions in more detail. All data conversion functions can be classified.

By type of data being converted:


By type of input and output parameters:

Conversion of integers


As mentioned above, the actions ConvertIntToString, ConvertIntCellToString, ConvertIntColToString are used to convert integers. They differ only in the type of input and output parameters, so we will not consider each of them in detail. Consider a simple example of converting numbers to a textual representation. Suppose that we need to select some numerical values ​​from the database table, then bring them to textual form according to the following rules: all numbers must be in the parental case, the end of textual representations of numbers should be feminine, numbers should be quantitative, not ordinal, the first letter of the resulting text representations of numbers must be large. First we need to get the data that we will convert. It has already been shown how this is done:

Example
 <step plugin="SqlDataSource" action="SqlSelectTable" repeat="1"> <input> <parameter name="query"> SELECT 1 AS int_column UNION SELECT 13013 UNION SELECT 55132111 UNION SELECT 1055132111 </parameter> </input> <output> <parameter name="table"></parameter> </output> </step> 


As a result of this action, an object of the ReportTable type containing one int_column column containing rows with the values ​​1, 13013, 55132111, 1055132111 will be stored in the collection of global objects.

Directly the transformation itself according to the requirements defined above can be carried out as follows:

Example
 <step plugin="ConvertModule" action="ConvertIntColToString" repeat="1"> <input> <parameter name="inTable">[table]</parameter> <parameter name="column">int_column</parameter> <parameter name="textCase">Genitive</parameter> <parameter name="sex">Female</parameter> <parameter name="firstCapital">true</parameter> <parameter name="isOrdinal">false</parameter> </input> <output> <parameter name="outTable">table</parameter> </output> </step> 


As a result, we will get a table named table with the following values: “One”, “Thirteen thousand thirteen”, “Fifty-five million one hundred thirty two thousand one hundred eleven”, “One billion fifty-five million one hundred thirty-two thousand one hundred eleven”.

Notice that the inTable and outTable parameters have the same ReportTable type. Since in this case the output parameter has the same name as the input parameter, it will simply replace the input parameter in the global parameter collection. This way you can easily make chains of transformations.

Real Number Transformations


For converting real numbers, the actions ConvertFloatToString, ConvertFloatCellToString, ConvertFloatColToString are used. Transformations of real numbers are very similar to transformations of integers, except that when converting real numbers you cannot specify the gender and what is the numeral (ordinal or quantitative). Consider a simple example of converting the number 3.1415926 into the prepositional sentence:

Example
 <step plugin="ConvertModule" action="ConvertFloatToString" repeat="1"> <input> <parameter name="number">3,1415926</parameter> <parameter name="textCase">Prepositional</parameter> <parameter name="firstCapital">false</parameter> </input> <output> <parameter name="words"></parameter> </output> </step> 


As a result, the words parameter will contain the value “three whole one million four hundred and fifteen thousand nine hundred twenty six ten million”. Despite the fact that System.Double is used as an input parameter for the conversion of a real number, the maximum size of the real part is limited to billions (9 decimal places). Technically, nothing interferes with doing more, but in practice the need for such accuracy has not yet arisen.

Date and Time Conversions


To convert the date and time, use the actions ConvertDateTimeToString, ConvertDateTimeCellToString, ConvertDateTimeColToString. As with the previous action groups, the actions described in this section for working with date and time are very similar. However, unlike transformations of integers and real numbers, these actions do not use the case and gender parameters. Instead, the more flexible format parameter is used. Let's take a closer look at which format representations are supported by date conversion actions:

Formats
  • dd - day of the month as a date
  • ddx - day of the month as text
  • MM - month as a number
  • MMx - month as text
  • yy - year in two-digit number format
  • yyx - year in two-digit number format as text
  • yyyy - year in four-digit number format
  • yyyyx - year in four-digit number format
  • hh - time from 1 to 12 as a number
  • hhx - time from 1 to 12 as text
  • HH - time from 0 to 23 as a number
  • HHx - time from 0 to 23 as text
  • mm - minutes as a number
  • mmx - minutes as text
  • ss - seconds as a number
  • ssx - seconds as text


In all the above formats, the letter "x" means the first letter of the case n (Nominative), g (Genetive), d (Dative), a (Accusative), i (Instrumental), p (Prepositional).

As you can see, the possibilities for customizing the format of the date representation are huge. . «1988-06-26 13:47:56» ( , «26.06.1988 13:47:56», ):

: dd MMg yyyy HHn mmn ssn
: 26 1988
: ddn MMg yyyyg
:
: dd.MM.yy (MMn yyyyg)
: 26.06.88 ( )

xml :

Example
 <step plugin="ConvertModule" action="ConvertDateTimeToString" repeat="1"> <input> <parameter name="dateTime">26.06.1988 13:47:56</parameter> <parameter name="format">dd.MM.yy (MMn yyyyg)</parameter> <parameter name="firstCapital">false</parameter> </input> <output> <parameter name="words"></parameter> </output> </step> 



ActivityManager CurrencyToString, CurrencyCellToString CurrencyColToString. , : , . . , decimal, dept, , , . , « ». :

Example
 <step plugin="ConvertModule" action="ConvertCurrencyColToString" repeat="1"> <input> <parameter name="inTable">[table]</parameter> <parameter name="column">dept</parameter> <parameter name="currencyType">Ruble</parameter> <parameter name="format">nii,ff (nniin rn ffn kn)</parameter> <parameter name="thousandSeparator"> </parameter> <parameter name="firstCapital">false</parameter> <parameter name="isOrdinal">false</parameter> </input> <output> <parameter name="outTable">table</parameter> </output> </step> 


, dept . «3 101 203,03 ( )».
:

  • ii — (, )
  • ff — ()
  • iix — (, )
  • ffx — ()
  • rx — «» («», «») — currencyType
  • kx — «» («») — currencyType
  • nn — « », . , . .
  • n — "-", . , . "-" .

«» n (Nominative), g (Genetive), d (Dative), a (Accusative), i (Instrumental), p (Prepositional).

.


, , . ActivityManager Padeg.dll. ConvertModule.dll ConvertNameToCase, ConvertNameCellToCase ConvertNameColToCase. , . , « » :

Example
 <step plugin="ConvertModule" action="ConvertNameToCase" repeat="1"> <input> <parameter name="nameIn">  </parameter> <parameter name="format">ss nn pp</parameter> <parameter name="textCase">Genitive</parameter> </input> <output> <parameter name="nameOut">words</parameter> </output> </step> 


« ».
format :

  • ss —
  • s —
  • nn —
  • n —
  • pp —
  • p —

, « » , np ss ( textCase) «.. ».


ConvertModule.dll , ReportTable ReportRow . RowConcat, ColumnConcat TableConcat. RowConcat ReportRow . ColumnConcat ReportTable. TableConcat ReportTable . Usage example

Example
 <step plugin="ConvertModule" action="TableConcat" repeat="1"> <input> <parameter name="inTable">[myTable]</parameter> <parameter name="rowSeparator">;</parameter> <parameter name="cellSeparator">,</parameter> </input> <output> <parameter name="outValue">myConcatedStr</parameter> </output> </step> 


myConcatedStr , myTable, (rowSeparator — , cellSeparator — ).


GetRow GetCell.

GetRow ReportRow ReportTable ( ). ReportRow ( « »). , ReportTable . GetRow:

Example
 <step plugin="ConvertModule" action="GetRow" repeat="1"> <input> <parameter name="table">[table]</parameter> <parameter name="rowNumber">0</parameter> </input> <output> <parameter name="row"></parameter> </output> </step> 


GetCell ReportTable:

Example
 <step plugin="ConvertModule" action="GetCell" repeat="1"> <input> <parameter name="table">[table]</parameter> <parameter name="rowNumber">0</parameter> <parameter name="columnName">myColumn</parameter> </input> <output> <parameter name="value"></parameter> </output> </step> 


GetCell GetRow .


.
ActivityManager odt, ods, docx xlsx. . -, . COM- - , . XML. , COM , . , , , WordPad , .


. — odt, ods, docx xlsx . . : $variable$, variable — . , .



6 : $title$, $date$, $n$, $snp$, $money$, $date$. .


ActivityManager ReportModule.dll. 5 .

ReportSetTemplateFile. , . . :

Example
 <step plugin="ReportModule" action="ReportSetTemplateFile" repeat="1"> <input> <parameter name="fileName">[reportPath]example.odt</parameter> </input> </step> 


[reportPath] , example.odt ActivityManager.exe . : .

, . ReportModule.dll ReportSetStringValue, ReportSetStringValues, ReportSetTableValue. . Consider them in order.

ReportSetStringValue , . . "$" . :

Example
 <step plugin="ReportModule" action="ReportSetStringValue" repeat="1"> <input> <parameter name="name">title</parameter> <parameter name="value"> 123</parameter> </input> </step> 






. , ReportTable GetCell. , . , . (, ), ReportSetStringValues. ReportRow. () . :

Example
 <step plugin="SqlDataSource" action="SqlSetConnectionString" repeat="1"> <input> <parameter name="connectionString">dsn=registry</parameter> </input> </step> <step plugin="SqlDataSource" action="SqlSelectTable" repeat="1"> <input> <parameter name="query">SELECT ' 321' AS title, NOW() AS date</parameter> </input> <output> <parameter name="table"></parameter> </output> </step> <step plugin="ConvertModule" action="GetRow" repeat="1"> <input> <parameter name="table">[table]</parameter> <parameter name="rowNumber">0</parameter> </input> <output> <parameter name="row"></parameter> </output> </step> <step plugin="ReportModule" action="ReportSetStringValues" repeat="1"> <input> <parameter name="values">[row]</parameter> </input> </step> <step plugin="ReportModule" action="ReportSetTemplateFile" repeat="1"> <input> <parameter name="fileName">C:\example.odt</parameter> </input> </step> <step plugin="ReportModule" action="ReportGenerate" repeat="1"> <output> <parameter name="fileName"></parameter> </output> </step> <step plugin="IOModule" action="IOOpenFile" repeat="1"> <input> <parameter name="fileName">[fileName]</parameter> <parameter name="arguments"></parameter> </input> </step> 


ReportTable . table title date. GetRow ReportTable ReportRow, 0 ( ) ReportTable. ReportRow ReportSetStringValues. , «», $title$ $date$ () ReportRow. example.odt ,



, $date$. , ReportSetStringValue ReportSetStringValues , : , , - , . . « ».

ReportSetStringValues () ReportRow . , . , , , . .

. .

ReportSetTableValue. :

Example
 <step plugin="ReportModule" action="ReportSetTableValue" repeat="1"> <input> <parameter name="table">[table]</parameter> <parameter name="xmlContractor">Row</parameter> </input> </step> 


table ReportTable, . ReportTable. , . , . , XML- , xmlContractor ( xmlContractor ) 50 ReportTable , . , , , ( ). $n$, $snp$, $money$, $date$. ReportSetTableValue ReportTable, n, snp, money, date, time, action, pay. , .. ReportTable ( 50% ), .

, ReportTable, . .., ReportTable



xmlContractor ReportSetTableValue. ReportTable. . 4 xmlContractor: Paragraph, Table, Row, Cell. . ,



. . xmlContractor Row ReportTable. , ReportTable ReportTable.



, , .. .
xmlContractor Table, ,



, , . ReportTable ReportTable . . ReportTable. xmlContractor Table , : , . , xmlContractor Table odt docx. ods xmlContractor Table ( ) ReportTable. , xmlContractor, xlsx.
xmlContractor Paragraph



ReportTable. xmlContractor .
xmlContractor Cell xlsx ods. . ods:



ReportSetTableValue, value.
xmlContractor Row :



ods, ReportTable ( , ), ReportTable.

, xmlContractor Cell:



, . , , . .

, , ReportModule.dll — ReportGenerate.

Example
 <step plugin="ReportModule" action="ReportGenerate" repeat="1"> <output> <parameter name="fileName"></parameter> </output> </step> 


. , ReportModule.dll , . ReportGenerate. . ReportGenerate . ReportGenerate , . . , . FTP- -. ( ) ActivityManager . IOOpenFile IOModule. :

Example
 <step plugin="IOModule" action="IOOpenFile" repeat="1"> <input> <parameter name="fileName">[fileName]</parameter> <parameter name="arguments"></parameter> </input> </step> 


, . .., , OpenOffice, LibreOffice, MS Word, WordPad, .


ReportSetStringValue, ReportSetStringValues, ReportSetTableValue , . , . Consider an example.

Example
 <step plugin="ReportModule" action="ReportSetStringValue" repeat="1"> <input> <parameter name="name">content</parameter> <parameter name="value">My name is $name$. My surname is $surname$.</parameter> </input> </step> <step plugin="ReportModule" action="ReportSetStringValue" repeat="1"> <input> <parameter name="name">name</parameter> <parameter name="value">Vasily</parameter> </input> </step> <step plugin="ReportModule" action="ReportSetStringValue" repeat="1"> <input> <parameter name="name">surname</parameter> <parameter name="value">Ignatov</parameter> </input> </step> 


$content$ «My name is $name$. My surname is $surname$.». $name$ $surname$ «Vasily» «Ignatov». «My name is Vasily. My surname is Ignatov.». , , $content$ , $name$ $surname$ ( ). «My name is $name$. My surname is $surname$.». .

-


- . , , , . . , ( ), , , . , ReportSetTableValue xmlContractor = Paragraph . -. GROUP_CONCAT MySQL, FOR XML MSSQL, TableConcat ConvertModule.dll, - .

$b$value$/b$. Those. : "$b$ $/b$, 29.06.1988 .., № 0123456 4321 ..., $b$ $/b$, 01.15.1976 .., № 654321 1234, ...". - . . $b$ $/b$ , .. :

- OpenOffice.
-:


.

JS


Conditions


ActivityManager . IOModule.dll. IOIfConditionToStep IOIfConditionExit. IOIfConditionToStep , true, IOIfConditionExit , true. . , , . ( , ) , . . , : — , , — , ..

Example
 <!-- step 5 --> <step plugin="JSModule" action="JSRun" repeat="1"> <input> <parameter name="script">return [id_rent_type] != 1</parameter> </input> <output> <parameter name="result">condition</parameter> </output> </step> <!-- step 6 --> <step plugin="IOModule" action="IOIfCondititonToStep" repeat="1"> <input> <parameter name="condition">[condition]</parameter> <parameter name="step">8</parameter> </input> </step> <!-- step 7 --> <step plugin="ReportModule" action="ReportSetTemplateFile" repeat="1"> <input> <parameter name="fileName">\\nas\media$\ActivityManager\templates\registry\tenancy\agreement_commercial.odt</parameter> </input> </step> <!-- step 8 --> <step plugin="JSModule" action="JSRun" repeat="1"> <input> <parameter name="script">return [id_rent_type] != 2</parameter> </input> <output> <parameter name="result">condition</parameter> </output> </step> <!-- step 9 --> <step plugin="IOModule" action="IOIfCondititonToStep" repeat="1"> <input> <parameter name="condition">[condition]</parameter> <parameter name="step">11</parameter> </input> </step> <!-- step 10 --> <step plugin="ReportModule" action="ReportSetTemplateFile" repeat="1"> <input> <parameter name="fileName">\\nas\media$\ActivityManager\templates\registry\tenancy\agreement_special.odt</parameter> </input> </step> <!-- step 11 --> <step plugin="JSModule" action="JSRun" repeat="1"> <input> <parameter name="script">return [id_rent_type] != 3</parameter> </input> <output> <parameter name="result">condition</parameter> </output> </step> <!-- step 12 --> <step plugin="IOModule" action="IOIfCondititonToStep" repeat="1"> <input> <parameter name="condition">[condition]</parameter> <parameter name="step">14</parameter> </input> </step> <!-- step 13 --> <step plugin="ReportModule" action="ReportSetTemplateFile" repeat="1"> <input> <parameter name="fileName">\\nas\media$\ActivityManager\templates\registry\tenancy\agreement_social.odt</parameter> </input> </step> <!-- step 14 --> <step plugin="JSModule" action="JSRun" repeat="1"> <input> <parameter name="script">return ([id_rent_type] == 1) || ([id_rent_type] == 2) || ([id_rent_type] == 3)</parameter> </input> <output> <parameter name="result">condition</parameter> </output> </step> <!-- step 15 --> <step plugin="IOModule" action="IOIfCondititonToStep" repeat="1"> <input> <parameter name="condition">[condition]</parameter> <parameter name="step">18</parameter> </input> </step> <!-- step 16 --> <step plugin="IOModule" action="IODebugMessage" repeat="1"> <input> <parameter name="message">       </parameter> </input> </step> <!-- step 17 --> <step plugin="IOModule" action="IOIfCondititonExit" repeat="1"> <input> <parameter name="condition">true</parameter> </input> </step> 


:



IOIfConditionToStep IOIfConditionExit , . JSRun JSModule.dll. (, ) JavaScript-. JSRun JavaScript. ActivityManger, []. JSRun Noesis.Javascript , . return result.

Cycles


IOIfConditionToStep JSRun . ,







, . . Let's get started





, . .

. ReportTable ( yearsTable):



ReportSetTableValue xmlClouser = Table . , ( )



, yearsTable, GetCell ( currentYear) yearsTable , ( MySQL)

Request
 SELECT @n := @n + 1 AS n[currentYear], snp AS snp[currentYear], money AS money[currentYear], DATE_FORMAT(date,'%d.%m.%Y') AS date[currentYear] FROM test, (SELECT @n := 0) v WHERE YEAR(date) = '[currentYear]' 


( ) ReportSetTableValue xmlClouser = Row .
:

 <?xml version="1.0" encoding="utf-8"?> <activity> <plugins> <include>ConvertModule.dll</include> <include>IOModule.dll</include> <include>JSModule.dll</include> <include>ReportModule.dll</include> <include>SqlDataSource.dll</include> </plugins> <language>ru</language> <step plugin="SqlDataSource" action="SqlSetConnectionString" repeat="1"> <input> <parameter name="connectionString">dsn=registry</parameter> </input> </step> <step plugin="SqlDataSource" action="SqlOpenConnection" repeat="1" /> <step plugin="SqlDataSource" action="SqlSelectTable" repeat="1"> <input> <parameter name="query"> SELECT DISTINCT YEAR(date) AS year, CONCAT('$n',YEAR(date),'$') AS n, CONCAT('$snp',YEAR(date),'$') AS snp, CONCAT('$money',YEAR(date),'$') AS money, CONCAT('$date',YEAR(date),'$') AS date FROM test ORDER BY year; </parameter> </input> <output> <parameter name="table">yearsTable</parameter> </output> </step> <step plugin="ReportModule" action="ReportSetTemplateFile" repeat="1"> <input> <parameter name="fileName">C:\Users\IgnVV\Desktop\1.odt</parameter> </input> </step> <step plugin="ReportModule" action="ReportSetTableValue" repeat="1"> <input> <parameter name="table">[yearsTable]</parameter> <parameter name="xmlContractor">Table</parameter> </input> </step> <step plugin="SqlDataSource" action="SqlSelectTable" repeat="1"> <input> <parameter name="query"> SELECT COUNT(*) AS count FROM ( SELECT DISTINCT YEAR(date) AS year FROM test ORDER BY year) v; </parameter> </input> <output> <parameter name="table">countYearsTable</parameter> </output> </step> <step plugin="ConvertModule" action="GetCell" repeat="1"> <input> <parameter name="table">[countYearsTable]</parameter> <parameter name="rowNumber">0</parameter> <parameter name="columnName">count</parameter> </input> <output> <parameter name="value">countYears</parameter> </output> </step> <step plugin="JSModule" action="JSRun" repeat="1"> <input> <parameter name="script">return [countYears] == 0</parameter> </input> <output> <parameter name="result">condition</parameter> </output> </step> <step plugin="IOModule" action="IOIfCondititonToStep" repeat="1"> <input> <parameter name="condition">[condition]</parameter> <parameter name="step">15</parameter> </input> </step> <step plugin="JSModule" action="JSRun" repeat="1"> <input> <parameter name="script">return [countYears]-1;</parameter> </input> <output> <parameter name="result">countYears</parameter> </output> </step> <step plugin="ConvertModule" action="GetCell" repeat="1"> <input> <parameter name="table">[yearsTable]</parameter> <parameter name="rowNumber">[countYears]</parameter> <parameter name="columnName">year</parameter> </input> <output> <parameter name="value">currentYear</parameter> </output> </step> <step plugin="SqlDataSource" action="SqlSelectTable" repeat="1"> <input> <parameter name="query"> SELECT @n := @n + 1 AS n[currentYear], snp AS snp[currentYear], money AS money[currentYear], DATE_FORMAT(date,'%d.%m.%Y') AS date[currentYear] FROM test, (SELECT @n := 0) v WHERE YEAR(date) = '[currentYear]';</parameter> </input> <output> <parameter name="table"></parameter> </output> </step> <step plugin="ReportModule" action="ReportSetTableValue" repeat="1"> <input> <parameter name="table">[table]</parameter> <parameter name="xmlContractor">Row</parameter> </input> </step> <step plugin="IOModule" action="IOIfCondititonToStep" repeat="1"> <input> <parameter name="condition">true</parameter> <parameter name="step">8</parameter> </input> </step> <step plugin="SqlDataSource" action="SqlCloseConnection" repeat="1" /> <step plugin="ReportModule" action="ReportGenerate" repeat="1"> <output> <parameter name="fileName"></parameter> </output> </step> <step plugin="IOModule" action="IOOpenFile" repeat="1"> <input> <parameter name="fileName">[fileName]</parameter> <parameter name="arguments"></parameter> </input> </step> </activity> 



, « JS », xml- , . : , , , , . . ,



( ). xml-. 4 , ( ): , , , . , drag'n'drop.

: «» ( ) «» ( ). . , , ( ) . , . . , , . xml- , plugins/. , , , .

Beginning of work


, . . : -> -> . , .



. . , . . .
. .
(, ) ,



. ( ), , .
Sytem.String ScintillaNET JavaScript SQL.



. «» .


, ActivityManager.exe .

, ActivityManager.exe . -> -> . ,



, config, ActivityManager.exe . , , .
. F5 -> -> . , , .



, , , , , . IODebugMessage IOModule. — , . ToString() , .
, , , ActivityManager . -> -> .

, xml- .


.Net , plugins\ :


MyModule.dll:

Example
 namespace MyModule { public interface IPlug { void MyAction(string input, out string output); } public class MenaPlug: IPlug { public void MyAction(string input, out string output) { output = input+input; } } } 


That's all. plugins\ ActivityManager AMEditor . MyAction :

Example
  <step plugin="MyModule" action="MyAction" repeat="1"> <input> <parameter name="input">test</parameter> </input> <output> <parameter name="output"></parameter> </output> </step> 


custom- MenaModule.cs

: ReportTable ReportRow ExtendedTypes.dll.

Conclusion


. ActivityManager . , :


, , , . - , - . , , . =)

Links


Source: https://habr.com/ru/post/245645/


All Articles