SDK
Tables

Functions

int SPI_GEN_str_array_new (const std::string &arrayName)
 Defines a new string table.
 
int SPI_GEN_str_array_select (const std::string &arrayName)
 Selects a table by its name.
 
int SPI_GEN_str_array_new_col (const std::string &colName)
 Defines a new column in the current table.
 
int SPI_GEN_str_array_new_lin (const std::string &cellContent)
 Writes a new cell in the current column.
 
int SPI_GEN_str_array_free ()
 Deallocates the current table.
 
int SPI_GEN_str_array_compact ()
 Eliminates identical rows in the current table.
 
int SPI_GEN_str_array_simple_sort (const std::string &colName, int sortType, int sortOrder)
 Compacts and sorts a column of the table known by its name according to a desired type of sorting.
 
int SPI_GEN_str_array_sort (int *colSortArray, int *sortTypeArray, int *sortOrderArray, int equalityColNb)
 Compacts and sorts the current table according to a column number
In case of an equality of 2 members, the comparison is made on the other designated columns.
 
int SPI_GEN_str_array_read (const std::string &colName, int linNb, std::string &msg)
 Reads the value of a cell from the current table.
 
int SPI_GEN_str_array_modify (const std::string &colName, int linNb, const std::string &msg)
 Modifies the content of a cell of the current table.
 
int SPI_GEN_str_array_col_width (const std::string &colName, int *width)
 Gives the width of a column of the current table.
 
int SPI_GEN_str_array_to_file (const std::string &dirName, const std::string &fileName, char separator)
 Creates an ascii file from the current table.
 
int SPI_GEN_str_array_to_editor ()
 Displays the current table in the text editor.
 

Detailed Description

Tables management

Function Documentation

◆ SPI_GEN_str_array_col_width()

int SPI_GEN_str_array_col_width ( const std::string & colName,
int * width )

Gives the width of a column of the current table.

Parameters
[in]colNamecolumn name of the current table
[out]widthcolumn width
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_GEN_str_array_col_width,'COL1',width);
int SPI_GEN_str_array_col_width(const std::string &colName, int *width)
Gives the width of a column of the current table.
Definition sp_gen03.c:425

◆ SPI_GEN_str_array_compact()

int SPI_GEN_str_array_compact ( )

Eliminates identical rows in the current table.

Version
4.4
Returns
SPI_YES if Ok | SPI_NO if error
Remarks
For compacted lines, the function SPI_GEN_str_array_read returns SPI_NO, to warn that they should not be treated
int SPI_GEN_str_array_compact()
Eliminates identical rows in the current table.
Definition sp_gen03.c:204

◆ SPI_GEN_str_array_free()

int SPI_GEN_str_array_free ( )

Deallocates the current table.

Version
4.4
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_GEN_str_array_free);
int SPI_GEN_str_array_free()
Deallocates the current table.
Definition sp_gen03.c:179

◆ SPI_GEN_str_array_modify()

int SPI_GEN_str_array_modify ( const std::string & colName,
int linNb,
const std::string & msg )

Modifies the content of a cell of the current table.

Version
4.4
Parameters
[in]colNamecolumn name of the current table
[in]linNbrow number of the designated column
[in]msgcel content
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_GEN_str_array_modify,'COL1',1,'text');
int SPI_GEN_str_array_modify(const std::string &colName, int linNb, const std::string &msg)
Modifies the content of a cell of the current table.
Definition sp_gen03.c:391
See also
SPI_GEN_str_array_read

◆ SPI_GEN_str_array_new()

int SPI_GEN_str_array_new ( const std::string & arrayName)

Defines a new string table.

Version
4.4
Parameters
[in]arrayNameName of the table (identifier)
Returns
SPI_YES if Ok | SPI_NO if error
Remarks
Do not forget to select and release the occupied tables
ier := ICALL(SPI_GEN_str_array_new,'TABLE');
int SPI_GEN_str_array_new(const std::string &arrayName)
Defines a new string table.
Definition sp_gen03.c:64
See also
SPI_GEN_str_array_free, SPI_GEN_str_array_select

◆ SPI_GEN_str_array_new_col()

int SPI_GEN_str_array_new_col ( const std::string & colName)

Defines a new column in the current table.

Version
4.4
Parameters
[in]colNameName of the table
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_GEN_str_array_new_col,'COL1');
int SPI_GEN_str_array_new_col(const std::string &colName)
Defines a new column in the current table.
Definition sp_gen03.c:125

◆ SPI_GEN_str_array_new_lin()

int SPI_GEN_str_array_new_lin ( const std::string & cellContent)

Writes a new cell in the current column.

Version
4.4
Parameters
[in]cellContentstring to copy into cell
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_GEN_str_array_new_lin,'LIN1');
int SPI_GEN_str_array_new_lin(const std::string &cellContent)
Writes a new cell in the current column.
Definition sp_gen03.c:152

◆ SPI_GEN_str_array_read()

int SPI_GEN_str_array_read ( const std::string & colName,
int linNb,
std::string & msg )

Reads the value of a cell from the current table.

Version
4.4
Parameters
[in]colNamecolumn name of the current table
[in]linNbrow number of the designated column
[out]msgcell content
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_GEN_str_array_read,'COL1',1,msg);
int SPI_GEN_str_array_read(const std::string &colName, int linNb, std::string &msg)
Reads the value of a cell from the current table.
Definition sp_gen03.c:357
See also
SPI_GEN_str_array_modify

◆ SPI_GEN_str_array_select()

int SPI_GEN_str_array_select ( const std::string & arrayName)

Selects a table by its name.

Version
4.4
Parameters
[in]arrayNamename of the table
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_GEN_str_array_select,'TABLE');
int SPI_GEN_str_array_select(const std::string &arrayName)
Selects a table by its name.
Definition sp_gen03.c:98

◆ SPI_GEN_str_array_simple_sort()

int SPI_GEN_str_array_simple_sort ( const std::string & colName,
int sortType,
int sortOrder )

Compacts and sorts a column of the table known by its name according to a desired type of sorting.

Version
4.4
Parameters
[in]colNamename of the column to be sorted
[in]sortTypetype of designated column
SPI_SORT_LIKE_CHARACTER
SPI_SORT_LIKE_INTEGER
SPI_SORT_LIKE_DOUBLEFLOAT
SPI_SORT_LIKE_DATE
[in]sortOrdersense of sorting
SPI_SORT_NORMAL_ORDER
SPI_SORT_REVERSE_ORDER
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_GEN_str_array_simple_sort,'COL1',SPI_SORT_LIKE_INTEGER,
SPI_SORT_NORMAL_ORDER);
int SPI_GEN_str_array_simple_sort(const std::string &colName, int sortType, int sortOrder)
Compacts and sorts a column of the table known by its name according to a desired type of sorting.
Definition sp_gen03.c:233
See also
SPI_GEN_str_array_sort

◆ SPI_GEN_str_array_sort()

int SPI_GEN_str_array_sort ( int * colSortArray,
int * sortTypeArray,
int * sortOrderArray,
int equalityColNb )

Compacts and sorts the current table according to a column number
In case of an equality of 2 members, the comparison is made on the other designated columns.

Version
4.4
Parameters
[in]colSortArraytable of column numbers to be tested for sorting (priority column at the start of the table)
[in]sortTypeArraycolumns types table
SPI_SORT_LIKE_CHARACTER
SPI_SORT_LIKE_INTEGER
SPI_SORT_LIKE_DOUBLEFLOAT
SPI_SORT_LIKE_DATE
[in]sortOrderArraysort direction table
SPI_SORT_NORMAL_ORDER
SPI_SORT_REVERSE_ORDER
[in]equalityColNbnumber of columns defined for equality tests
Returns
SPI_YES if Ok | SPI_NO if error
Remarks
To sort, all cells in a column are tested member to member
The column number is given in colSortArray[0],
its type is given in sortTypeArray[0] and
the direction of sorting on this column is given in sortOrderArray[0]
If 2 cells are identical, the neighboring cells of the same 2 lines
are then compared, if the equality persists, other
cells of the same 2 lines are taken, and so on ...
The order in which the columns are taken into account is given in:
colSortArray[1], colSortArray[2] ... colSortArray[equalityColNb-1]
For each of these columns, their type and sorting direction is specified
in sortTypeArray and sortOrderArray
ier := ICALL(SPI_GEN_str_array_sort,tab_col_sort,tab_typ_sort,tab_sens_sort,3);
int SPI_GEN_str_array_sort(int *colSortArray, int *sortTypeArray, int *sortOrderArray, int equalityColNb)
Compacts and sorts the current table according to a column number In case of an equality of 2 membe...
Definition sp_gen03.c:281
See also
SPI_GEN_str_array_simple_sort

◆ SPI_GEN_str_array_to_editor()

int SPI_GEN_str_array_to_editor ( )

Displays the current table in the text editor.

Version
4.4
Returns
SPI_YES if Ok | SPI_NO if error
int SPI_GEN_str_array_to_editor()
Displays the current table in the text editor.
Definition sp_gen03.c:489

◆ SPI_GEN_str_array_to_file()

int SPI_GEN_str_array_to_file ( const std::string & dirName,
const std::string & fileName,
char separator )

Creates an ascii file from the current table.

Version
4.4
Parameters
[in]dirNamefile directory
[in]fileNamefile name
[in]separatorcolumn separation character
Eg ' ' or ';' or '/' or '\t' (tab)
Returns
SPI_YES if Ok | SPI_NO if error
Remarks
The width of the columns is calculated according to the widest member of each of the columns in order to have good readability of the table
ier := ICALL(SPI_GEN_str_array_to_file,'c:\temp','TOTO.CSV',';');
int SPI_GEN_str_array_to_file(const std::string &dirName, const std::string &fileName, char separator)
Creates an ascii file from the current table.
Definition sp_gen03.c:452