1 Report
A report is a formatted and organized presentation of data. Can be generated different types of reports easily as well create financial and operational reports.
Operator XSQL | Equivalent server-side script | Description |
---|---|---|
$0 | Ax.context.property.COND | Gets the value that has the indicated inputs in the form where it is located. |
$0 | Ax.context.property.COND.toXML() | Gets the value parsed to XML that has the indicated inputs in the form where it is located. |
$COLUMNA | Ax.context.variable.columna | Gets the value that the indicated variable has for the form where it is positioned. |
keep in mind
The next example should not be run in DBStudio console. This code goes in the sentence of Report type objects
<call> <args> <arg>$0</arg> <arg>$FECMOD</arg> <arg>$SALSTART</arg> <arg>$SALEND</arg> <arg>$TAXRATE</arg> </args> <![CDATA[ <xsql-script name='report_Test'> <args> <arg name='p_sqlcond' type='string' /> <arg name='p_fecmod' type='date' /> <arg name='p_sal_start' type='integer' /> <arg name='p_sal_end' type='integer' /> <arg name='p_tax_rate' type='integer' /> </args> <body> <if> <expr> <select> <columns>COUNT(*)</columns> <from table='tst_employees' /> <where> #p_sqlcond and salary > <p_sal_start/> and salary < <p_sal_end/> </where> </select> </expr> <then> <update table='tst_employees'> <column name='fecmod'><p_fecmod /></column> <column name='tax_rate'><p_tax_rate /></column> <where> #p_sqlcond and salary > <p_sal_start/> and salary < <p_sal_end/> </where> </update> </then> <else> <exception> No se encontraron empleados que cumplan las condiciones necesarias solicitadas. </exception> </else> </if> </body> </xsql-script> ]]> </call>
/* ** Data that get from the input and variables of the form */ var mStrSqlCond = Ax.context.property.COND; var mDateFecmod = Ax.context.variable.FECMOD; var mIntSalStart = Ax.context.variable.SALSTART; var mIntSalEnd = Ax.context.variable.SALEND; var mIntTaxrate = Ax.context.variable.TAXRATE; var mCount = Ax.db.executeGet(` <select> <columns>COUNT(*)</columns> <from table='tst_employees' /> <where> ? and salary > ? and salary < ? </where> </select> `, mStrSqlCond, mIntSalStart, mIntSalEnd); if(mCount > 0){ Ax.db.execute(` <update table='tst_employees'> <column name='fecmod'><p_fecmod /></column> <column name='nivel'><p_nivel /></column> <where> ? and salary > ? and salary < ? </where> </update>`, mStrSqlCond, mIntSalStart, mIntSalEnd); }else{ throw new Exception("No se encontraron empleados que cumplan las condiciones necesarias solicitadas."); } return Ax.db.executeQuery(` <select> <columns> * </columns> <from table='tst_employees' /> <where> ? and salary > ? and salary < ? </where> </select>`, mStrSqlCond, mIntSalStart, mIntSalEnd);
Besides
Note that you can use embed code or you can also call the same embed code snippet but cataloged in the database dictionary.2 Button Actions
Button actions are what contain the button logic meanwhile the form actions is an abstract parameterization of actions that can be activated from the allowed components of an Axional Studio Formauto. These actions can be activated from different components.
Operator XSQL | Equivalent server-side script | Description |
---|---|---|
${columna} | Ax.context.data.columna | Gets the value of the indicated column in the main form where it is placed. |
${parent('columna')} | Ax.context.parent.columna | Gets the value of the indicated column in the parent of the main form where it is placed. |
$VARIABLE | Ax.context.variable | Gets the value that the indicated variable has for the form where it is positioned. |
? | Ax.context.field.columna | Gets the value that the indicated column has in the form modal where it is positioned. |
keep in mind
The next example should not be run in DBStudio console. This code goes in the sentence of Button actions
<call> <args> <arg>${apteid}</arg> <arg>${field('feccan')}</arg> </args> <![CDATA[ <xsql-script name='set_debug'> <args> <arg name='p_apteid' type='integer' /> <arg name='p_feccan' type='date' /> </args> <body> <update table='cavalesh'> <column name='estado'>C</column> <column name='feccan'><p_feccan/></column> <where> apteid = ${apteid} </where> </update> <delete table='taptcuen'> <where> fecope >= <p_feccan /> AND EXISTS (SELECT cavalesh.apteid FROM cavalesh, cavalesl, cavalest WHERE taptcuen.apteid = cavalest.apteid AND cavalest.rowenl = cavalesl.linava AND cavalesl.rowenl = cavalesh.apteid AND cavalesh.apteid = <p_apteid/>) AND concil = 'N' AND feccon IS NULL </where> </delete> </body> </xsql-script> ]]> </call>
/* ** Data that get from the input and variables of the form */ var mIntApteid = Ax.context.data.apteid; var mDateFeccan = Ax.context.field.feccan; Ax.db.update('cavalesh', { estado : 'C', feccan: mDateFeccan }, { apteid : mIntApteid } ); Ax.db.execute(` <delete table='taptcuen'> <where> fecope >= ? AND EXISTS (SELECT cavalesh.apteid FROM cavalesh, cavalesl, cavalest WHERE taptcuen.apteid = cavalest.apteid AND cavalest.rowenl = cavalesl.linava AND cavalesl.rowenl = cavalesh.apteid AND cavalesh.apteid = ?) AND concil = 'N' AND feccon IS NULL </where> </delete>`, mDateFeccan, mIntApteid);
Besides
Note that you can use embed code or you can also call the same embed code snippet but cataloged in the database dictionary.3 TX Manager
The Tx Manager or Transaction Controller allows to define actions to be taken on the INSERT, DELETE, MODIFY, or RESET events of records called from the object.
3.1 Reset
In an object, when the clean icon is clicked and starts a new transaction, it is possible to define default values in the form.
Operator XSQL | Equivalent server-side script | Description |
---|---|---|
${columna} | Ax.context.field.columna | Gets the value that the indicated column has in the form where it is positioned. |
${parent('columna')} | Ax.context.parent.columna | Gets the value that the indicated column has in the parent form where it is positioned. |
$VARIABLE | Ax.context.variable | Gets the value that the indicated variable has for the form where it is positioned. |
The next example should not be run in DBStudio console. This code goes in the sentence of the TX Manager.
<call> <args> <arg>${parent('dlvh_cabid')}</arg> <arg>${parent('dlvh_fecini')}</arg> <arg>${parent('dlvh_fecfin')}</arg> </args> <![CDATA[ <xsql-script> <args> <arg name='p_dlvh_cabid' type='integer' /> <arg name='p_dlvh_fecini' type='date' /> <arg name='p_dlvh_fecfin' type='date' /> </args> <body> <select prefix='m_'> <columns> NVL(MAX(gven_dlvplan_line.dlvl_orden), 0) + 5 </columns> <from table='gven_dlvplan_line' /> <where> gven_dlvplan_line.dlvh_cabid = <p_dlvh_cabid /> </where> </select> <return> <map name='v_query_map'> <item>dlvl_entini<p_dlvh_fecini /></item> <item>dlvl_entfin<p_dlvh_fecfin /></item> <item>dlvl_orden<m_dlvl_orden /></item> </map> </return> </body> </xsql-script> ]]> </call>
let mIntOrden = Ax.db.executeGet(` <select> <columns> <nvl>MAX(gven_dlvplan_line.dlvl_orden), 0</nvl> + 5 </columns> <from table='gven_dlvplan_line' /> <where> gven_dlvplan_line.dlvh_cabid = ? </where> </select> `, Ax.context.parent.dlvh_cabid); let mArrReturn = { dlvl_entini : Ax.context.parent.dlvh_fecini, dlvl_entfin : Ax.context.parent.dlvh_fecfin, dlvl_orden : mIntOrden }; return mArrReturn;