{{indexmenu_n>1}} ====== Business Rules ====== \\ Explanation of the different "events" available in XOne Platform to define the business rules. \\ ===== RUNSCRIPT ===== \\ Execution of XOneScript code inside of our application. In this case, it has no attribute, but it has a node where we will put the script to be executed, as shown in the example below. \\ ===== SETFLDVAL ===== \\ To take a value from a field in the father collection and put it in a field of the daughter collection. Used in the contents. \\ ^Attribute ^Description ^ | name | Name of the action to execute | | targetfld | Field to be updated with the father field. | | sourcefld | Field of the father collection that will give value to the field of this collection. | ===== MAPVAL ===== \\ We look for a value in another collection and we take back the value from any field. \\ \\ ^Attribute ^Description ^ | name | Name of the action to execute | | field | Field to be updated | | targetfld | Field name that has the value assigned to the **field** field.| | coll | Collection where the searching of the field which have the required value will be made. | | mapfld | Field of the collection that is defined in the **coll** attribute, that is the first key of it. | | mapvalue | Value of the field of the first key to rescue the log searched. | ===== EXECUTESQL ===== \\ To execute an SQL, Insert, Update oR Delete sentence. It has no sense to execute a Select, because the action does´t return any value. \\ \\ Widely used in header collections, when you are deleting a record, delete all of its associated lines.\\ \\ \\ ^Attribute ^Description ^ | name | Name of the action to execute. | | sql |SQL sentence to be executed. Valid only the execution of Insert, Update orDelete. | ===== LINK ===== \\ To update a link field of a details collection with the ID of the heading. \\ \\ Used EXCLUSIVELY in the INSERT node of a header collection. To link the detail lines of the CONTENTS collection when registering at the same time the header and the details, because until the header is not saved, the detail lines do not know what the ID of their father is. \\ ^Attribute ^Description ^ | name | Name of the action to execute | | coll | Collection searched to update the link field with this Father collection. | | field | Field name of the collection with the name defined in the **coll** attribute and that is the link with this Father collection. | | value | Value assigned to the link field between the Father collection and the daughter collection. | ====== BEFOREACTION NODE ====== \\ Node to expose the actions to be made in the events defined in our application, being able to be executed each and every one of the types of actions available to the **nodo action**. \\ Nevertheless, as a very important point to take in mind, is that this action only is valid for the event [[wiki:2.-desarrollo-app:2.3.-codigo:c.-eventos:3.-insert:start| Insert ]] event and it is used for validating fields, so that in case of error, the object is not saved, and the user is forced to insert a value for the validated field.