Settings


The configurations or "Settings" are located within the File in "File Types." These settings allow you to automatically execute logical functions depending on the situation or status of the File. In the "File Type" edition, options for configuring custom export and preloading events prior to loading and saving the File are included.







In the File Type edition, options are included to configure custom export, as well as events that occur prior to loading and saving a File.


Custom Export


Allows you to define a customized export for the File Type. This is achieved through the definition of a JSON object:


{"CustomSPName":"SP_Custom_Export","Columns":                [{"Section":"Header","Header":"TipoLinea:C;Company;Branch;Brand;TAX_Id;Date;InvoiceDate;Number;Departament;FileType;SupplierType"},{"Section":"Items","Header":"RowType:D;DocReference;Detail;Total;Account;Sum"},{"Section":"Taxes","Header":"TipoLinea:I;Code;Total;%"}]}


CustomSPName: The name of the stored procedure created for the custom export.Columns: A list of objects representing the columns to be exported. Each column element contains the following properties:

Section: Represents an object within the File Type. "Header" is the default section that includes the fields of the File Type that are not grid fields.         For grid-type fields, the field name must be specified here.

Header: A concatenation (using “;”) of the field names to export if in the "Header" section. Otherwise, it represents the column names when in a         grid-type section.


PreLoad Event


This feature allows you to define a script for validations before the File form is loaded.


It is useful for pre-configuring field values in the File or performing validations by sending messages to the screen for the user to view.

For this type of event, only TSQL can be used, as shown below:


BEGIN

--New or Update

If({cc_LegajoId}=0)

Begin

Select '{"ResultMessage":"", "FileName":"", "Fields":[{"RowId":0,"Name":"Total", "Values":[{"Name":"","Value":"102"}]}]}' As Result;

End

Else

Begin

Select '{"ResultMessage":"", "FileName":"", "Fields":[{"RowId":0,"Name":"Total","View":"1","Edit":"1","Values":[{"Name":"","Value":"304,3"}]}]}' As Result;

End;

END


If we want to evaluate a new File, it will enter when its ID is 0; otherwise, it is for an existing File.

The result is a JSON object where:


  • ResultMessage: The message displayed on the screen (if left empty, nothing is shown).
  • LegajoName: If used, it replaces the File's name with the value created here. This is useful for dynamically initializing a File's name based on specific client requirements.
  • Fields: A list of objects representing the File's fields. The fields loaded here will be used to pre-configure their values in the File.



PreSave Event


It follows the same format as the PreLoad event. It is useful for performing validations before saving a File.

If the object returns a value set in ResultMessage, the File is not saved, and the error is reported on the screen

.

Mandatory Attachments When Creating a File:


A common use of "PreSave" is to validate field completeness, especially for attachments.


BEGIN

If('@pedidoCotizacion' = '')

Begin

Select '{"ResultMessage":"You must complete the Attached Request for Quote", "FileName":"", "Fields":[{"RowId":0,"Name":"","View":"","Edit":"","Values":[{"Name":"","Value":""}]}]}' As Result;

End

Else

Begin

Select '{"ResultMessage":"", "FileName":"", "Fields":[{"RowId":0,"Name":"","View":"","Edit":"","Values":[{"Name":"","Value":""}]}]}' As Result;

End;

END


To use this script, modify the IF statement with the name of the attachment you want to validate, preceded by "@". In this example, the attachment type is named "pedidoCotizacion."

If the attachment is not uploaded, "@pedidoCotizacion" returns an empty field. The script then enters the first statement and returns an error message, which you can customize within ResultMessage (in the example: "Debe completar el Adjunto Pedido de Cotización").




Postsave Event


This event is executed once the File has been saved. For example, it waits for authorizations from other systems and only takes action once the File is saved.


BEGIN

END




Tabchange Event


When using multiple tabs (Groups) in the File Type, this action enables logical functions during navigation, such as validations, events, and controls. 


BEGIN

 DECLARE @LeavingTab nvarchar(100) = '{cc_LeavingTab}';

 DECLARE @EnteringTab nvarchar(100) = '{cc_EnteringTab}';

 

 --Treat Leaving Tab

 If(@LeavingTab!='')

 Begin

   Select '{"ResultMessage":"", "FileName":"", "Fields":[{"RowId":0,"Name":"","View":"","Edit":"","Values":[{"Name":"","Value":""}]}]}' As Result;

 End;

 --Treat Entering Tab

 If(@EnteringTab!='')

 Begin

   Select '{"ResultMessage":"", "FileName":"", "Fields":[{"RowId":0,"Name":"","View":"","Edit":"","Values":[{"Name":"","Value":""}]}]}' As Result;

 End;

END




Created with the Personal Edition of HelpNDoc: Why Microsoft Word Isn't Cut Out for Documentation: The Benefits of a Help Authoring Tool