In esProc we can perform parallel processing on big text files conveniently. The following example will illustrate the method.
There is a text file, sales.txt, with ten million sales records. Its main fields include SellerID, OrderDate and Amount. Now compute each salesman’s total amount of big orders in the past...
2015-03-19 837 0
0
JSON is a common data-interchange format. JSON data come from external Java programs, local files or the HTTP server. esProc can easily parse the JSON strings and compute them.
The following examples will show in detail how to write an esProc script for doing this.
The first case is the one in which the JSO...
2015-03-18 1178 0
0
esProc’s Hadoop datasource includes mainly HDFS files and Hive database. The way of accessing Hive database is similar to that of accessing other databases, so we won’t discuss it here. esProc has the built-in method of accessing HDFS files, which resembles that of accessing files from an ordinary file system. We’ll in...
2015-03-18 1081 0
0
The RBP_VALUE field in the rbd_dtl table stores the string “all” and some letters. We want to convert values in the field to strings of segments. The desired result is A-F,H,J-K,N-O,Q-S,U-V,X-Z.
Below is the original data:
Rules to be followed are:
If RBP_VALUE= “ALL”, then discard the value;
According to the alphabet...
2015-03-17 974 0
0
It is difficult to deal with some unconventional statistical tasks using the reporting tool, like Jasper and BIRT, alone or SQL. One example is the crosstab in which both the row headers and column headers are intervals, and whose measurement comes from anther database table. With powerful structured data computing eng...
2015-03-16 1258 0
0
Programmers often encounter complicated SQL-style computations during database application development. Record splitting, for example, is to split a record separated by a certain separator into multiple ones. For different databases, SQL has various problems like poor syntax support and the need of writing nested and m...
2015-03-13 1103 0
0
In database table REF_VALUES, ID column acts as the primary key and ORIGINAL_VALUE is used as the original column, whose values are to be shuffled and updated to the empty SHUFFLED_VALUE column. Below is a selection from the table:
SQL approach:
Databases differ in their solution to the problem. Here Oracle is u...
2015-03-12 1110 0
0
Databases, such as MSSQL and ORACLE, support updating tables using MERGE statement. But they lack functions for performing set operations. If data structure of the target table is unknown, it is very complicated to use the stored procedure to get its data structure and then compose the dynamic SQL statement. This may n...
2015-03-11 989 0
0
The MERGE statement provided by databases like MSSQL and ORACLE is very convenient for updating tables. But it is not as convenient as it is expected to be when the source table and target table exist in different databases. In this case esProc is able to rise to the occasion and assists the operation.
source and targe...
2015-03-10 1031 0
0
Database table dColThread is the primary table with the primary key tID. dColQuestion is the subtable with the foreign key tID, as shown in the following figures:
dColThread
dColQuestion
The desired report will display data in the grid in which the primary table is presented according to ApplicationName. Each record ...
2015-03-09 1124 0
0
esProc can import the data from and write them into Excel files by making the Excel one of its various datasources. Two simple examples will show how this works.
First let’s look at the data importing. The target files are data.xlsx and data.xls (excel97-2000 format) and have the same content. sheet0 is named employee ...
2015-03-06 1102 0
0
With esProc, the code for a loop is mainly written with for statement. The for statement will repeatedly execute the code block with for being the master cell. There are different formats of for statements, as listed below:
1. for loop
An unconditional loop is the one where the values of the master cell are, in tu...
2015-03-05 969 0
0
During data reporting there are many unconventional statistical tasks that are difficult to be handled solely by reporting tools, like Jasper and BIRT, or SQL. One case is to specify a particular record in the original data against which we cross-calculate all other records and derive new field values like percentages ...
2015-03-04 877 0
0
MongoDB script has limited computational ability in realizing complicated operations, so it is difficult to solve problems of this kind using it alone. In many cases, you can only perform further computations after retrieving the desired data out. And there is no less difficulty in trying to realizing this kind of set ...
2015-03-03 888 0
0
When using branch statements, we need to check one or multiple conditions, execute different code according to the results or return different results. In esProc, the if/else statement is used to realize branching. It has the following forms:
1. if x … else … in the same line
When condition x after if is true, the stat...
2015-02-28 874 0
0