1 Ax.ext.rs

1.1 Ax.ext.rs.decorate

Decorate a ResultSet with labels and includes from dictionary.

1. Ax.ext.rs.decorate

object Ax.ext.rs.decorate(string rs, string|json tabname , string lang);
				
Parameters
NameTypeRequiredDescription
rsstring 
tabnamestring|json The table in the logic dictionary that has the descriptions for the columns of the resultset, or a json mapping which columns belong to each table
langstring Desired language of the memo when omitted the user language is used
Example
Copy
<script>																
	const rs =  Ax.db.executeQuery('SELECT * FROM studio_employees');		
	const rsDec =  Ax.ext.rs.decorate(rs, 'studio_employees', 'en');		
	console.log(rsDec);		
+----------------+----------------+----------------+----------------+----------------+----------------+----------------+
|studio_employees|studio_employees|studio_employees|studio_employees|studio_employees|studio_employees|studio_employees|
|emp_no          |first_name      |last_name       |birth_date      |gender          |hire_date       |state           |
|Employee number |First name      |Surname         |Birth date      |Gender          |Hide date       |State           |
|int             |varchar(14)     |varchar(16)     |date            |char(1)         |date            |char(1)         |
+----------------+----------------+----------------+----------------+----------------+----------------+----------------+
|          10.001|Georgi          |Facello         |02/09/1953      |M               |26/06/1986      |Activo          |
|          10.002|Bezalel         |Simmel          |02/06/1964      |F               |21/11/1985      |Bloqueado       |
|          10.003|Parto           |Bamford         |03/12/1959      |M               |28/08/1986      |Activo          |
|          10.004|Chirstian       |Koblick         |01/05/1954      |M               |01/12/1986      |Activo          |
|          10.005|Kyoichi         |Maliniak        |21/01/1955      |M               |12/09/1989      |Activo          |
|          10.006|Anneke          |Preusig         |20/04/1953      |F               |02/06/1989      |Activo          |
|          10.007|Tzvetan         |Zielinski       |23/05/1957      |F               |10/02/1989      |Activo          |
|          10.008|Saniya          |Kalloufi        |19/02/1958      |M               |15/09/1994      |Activo          |
|          10.009|Sumant          |Peac            |19/04/1952      |F               |18/02/1985      |Activo          |
|          10.010|Duangkaew       |Piveteau        |01/06/1963      |F               |24/08/1989      |Activo          |
+----------------+----------------+----------------+----------------+----------------+----------------+----------------+
</script>
Example
Copy
<script>																
	const rs =  Ax.db.executeQuery('SELECT * FROM studio_employees');		
	const rsDec =  Ax.ext.rs.decorate(rs, {'studio_employees': ['emp_no'],'virtualjunit': ['first_name'] }, 'en');		
	console.log(rsDec);		
+----------------+----------------+----------------+----------------+----------------+----------------+----------------+
|studio_employees|studio_employees|studio_employees|studio_employees|studio_employees|studio_employees|studio_employees|
|emp_no          |first_name      |last_name       |birth_date      |gender          |hire_date       |state           |
|Employee number |FIRST NAME!!    |Surname         |Birth date      |Gender          |Hide date       |State           |
|int             |varchar(14)     |varchar(16)     |date            |char(1)         |date            |char(1)         |
+----------------+----------------+----------------+----------------+----------------+----------------+----------------+
|          10.001|Georgi          |Facello         |02/09/1953      |M               |26/06/1986      |Activo          |
|          10.002|Bezalel         |Simmel          |02/06/1964      |F               |21/11/1985      |Bloqueado       |
|          10.003|Parto           |Bamford         |03/12/1959      |M               |28/08/1986      |Activo          |
|          10.004|Chirstian       |Koblick         |01/05/1954      |M               |01/12/1986      |Activo          |
|          10.005|Kyoichi         |Maliniak        |21/01/1955      |M               |12/09/1989      |Activo          |
|          10.006|Anneke          |Preusig         |20/04/1953      |F               |02/06/1989      |Activo          |
|          10.007|Tzvetan         |Zielinski       |23/05/1957      |F               |10/02/1989      |Activo          |
|          10.008|Saniya          |Kalloufi        |19/02/1958      |M               |15/09/1994      |Activo          |
|          10.009|Sumant          |Peac            |19/04/1952      |F               |18/02/1985      |Activo          |
|          10.010|Duangkaew       |Piveteau        |01/06/1963      |F               |24/08/1989      |Activo          |
+----------------+----------------+----------------+----------------+----------------+----------------+----------------+
</script>

it' also possible to fine-tune the column to table mapping. The function Ax.ext.rs.decorate also supports