Access and automatic creation of other formsBrowse other formsSuppose that at the level of a file follow-up, we want to calculate the time spent on this file, and that this one is filled in the form of a set of files whose type is 'temps_passe' and which contain a decimal type 'hours' field. var Float t := 0 The 'each_form' instruction (historically 'forms') allows you to browse all the other forms of the current page. var Float t := 0 Sometimes, we want to find information common to all the files in a zone of the tree structure, which will be stored in a single file at the root of this zone. In the following example, we find the customer code in a 'customer' type form which contains a 'code' field, and it is stored in the local variable 'c' which will be used in the rest of the calculation: var Str c You can also browse all the currently selected forms. each_form selection Finally, we can browse all the forms of the current sheet (a sheet is an element of a stack): each_form sheet The 'field' instruction allows you to specify the fields to which you want to access, as well as their type. var Float t := 0 Finally, in some cases, for example an expert system, we will want to browse all the files in order. We can then use the 'version' instruction to determine the type of the file and carry out the appropriate processing: forms When browsing other records, it is possible that the browsed records have changed over time, and that in fact certain fields do not exist in all cases. We can then test the existence of a field using the 'exists' function: var Float t := 0 One last important note about the 'forms' instruction. When the program is executed after pressing a button, the fields of the browsed forms can be modified. ▸ Pre-fill a field of a record using the other records on the page Create other formsIt is the 'new_form' instruction that allows you to generate a new form. It contains a block that will be executed to allow you to modify certain fields of the new form. In the following example, we save the current date and time in the 'd' field of the new form. new_form "identifiant_du_formulaire_a_recopier" The 'new_form' instruction accepts many options: new_form "identifiant" copy_fields Copies the fields of the form being executed to the new form (only if they are not empty in the form). new_form "identifiant" before "identifiant_de_bloc" Le nouveau formulaire sera créé juste au dessus du bloc spécifié. new_form "identifiant" after "identifiant_de_bloc" Le nouveau formulaire sera créé juste sous le bloc spécifié. 'below' est l'ancienne version de 'after'. new_form "identifiant" page "identifiant_de_page" The new form will be created at the bottom of the specified page. new_form "identifiant" tail "identifiant_de_bloc" The new form will be created at the bottom of the page containing the specified block. new_form "identifiant" page "identifiant_de_page" subpage "id_sous_page_niveau_1" "titre de la sous page niveau 1" subpage "id_sous_page_niveau_2" "titre de la sous page niveau 2" The new form will be placed in a two-level subtree of the specified page. var DateTime dt := ... Lets you put the new form in a stack. The additional parameters 'date' 'from' and 'subject' are optional. In the past, 'subject' was noted as 'title'. You can combine the 'page', 'subpage' and 'stack' or 'below' 'subpage' and 'stack' attributes, as well as 'copy_fields' with all the others. Finally: new_form "identifiant" location "nom_de_la_position" Used to place the new form in a position that will have been previously defined via the 'define_location' instruction. For example: new_sheet stack "s" ▸ Form for entering a comment Modify the content of another existing recordA fundamental rule to limit complexity in Storga applications is that the program of one form can access data from any other, but not modify it. The goal is to prevent files from being modified by a program we do not know where, i.e. that we notice that a field has changed, but that we cannot easily determine why . There are two ways to get around this restriction.
Suppose that a form A must modify the content of a form B. It uses the 'compute_form' instruction to send it a message. For form B, it is a bit as if a button had been pressed by the user, except that the code of the button can also contain values \u200b\u200b(the parameters of the message, i.e. roughly the values \u200b\u200bto be recorded ). The code of file A could be for example: var Int i := ... # calcul la valeur à stocker dans la fiche B And that of sheet B: if (button_name parse "please_record_value" (var Int i)) # la fiche B traite le message |