Transferring additional Report Templates to the App
By default, the App Server only transfers the necessary reporting templates. These result from the pre-planned reports
and completed reports in the assignment and project. In the Reports tab within the Mobile App, the technician can create a report by clicking the
button. All reporting templates available on the app are displayed. For some standard templates, it may be useful to transfer these to the app by default so that they do not have to be planned in advance in the assignment or project if necessary.
Definition of UDF
The App Server checks once during startup whether a UDF with the name "UDF_CUS_APP_DEFAULT_CR_TEMPLATES" exists and whether the parameters of the UDF are compatible. The UDF defines a list of VersionGroups, which is the cross-version ID of a report template (CR_Template.VersionGroup). The App Server executes this UDF in every data transfer and also transfers the highest, released template version of the returned VersionGroups to the app if the version is not yet available on the app.
The UDF is only checked at startup. If you create or remove the UDF or change the parameter list, you must restart the App Server so that the changed UDF is recognized. If the implementation is changed (parameter list remains the same), no restart is necessary.
Avoid overly complex SQLs, as the UDF is executed in every data transfer run. You can map more complex relationships using a CUS table, which you fill using triggers or other mechanisms and then select in the UDF in a filtered manner.
The App Server supports the following parameters, all of which are optional:
|
Parameter (optional) |
Data type |
Remark |
|
ogrnr |
int |
Main group ID of the technician |
|
ressnr |
nvarchar(20) |
Resource ID of the technician |
|
stammogrnr |
int |
Master maingroup ID of the technician |
The returned result set should contain the following columns. The following also applies:
No other columns may be included.
|
Column name |
Data type |
Remark |
|
versiongroup |
Analog to CR_Template.VersionGroup |
The column does not have to be unique. |
The App Server transfers report templates to the returned VersionGroups that meet the following requirements:
The App Server only transmits the highest, released version of a report template.
The App Server does not transfer deactivated report templates.
SQL examples
The following UDF includes all templates that have been marked with the "SendToApp" label in a version. The "ogrnr" parameter is not used and is only used to clarify parameters.
CREATE OR ALTER FUNCTION UDF_CUS_APP_DEFAULT_CR_TEMPLATES(@ogrnr int)RETURNS TABLEAS RETURN ( SELECT t.VersionGroup FROM CR_TEMPLATE t WHERE EXISTS ( SELECT * FROM OBJECTTAG o WHERE o.ObjectType = 'CrTemplate' AND o.ObjectId = t.Id AND o.Tag = 'SendToApp' ));