1Ci Support Help Center home page
Submit a request
Sign in
  1. 1Ci Support
  2. 1C:Enterprise Development Standards
  3. Designing user interfaces
  4. Implementation of form

Contextual and non-contextual transfer of control to the server

  • Implementation of form
    • Opening forms
    • Opening parameterized forms
    • Rules for creating form modules
    • Locking or independent opening of object forms
    • Modal windows use restrictions
    • Preventing editing table fields by condition
    • Specifics of spreadsheet document in a web client
    • Accessing automatically generated form controls from code
    • Accessing user form controls from code
    • Object modification commands
See more

Scope: a managed application, a mobile application.

1. 1C:Enterprise platform allows to transfer control from a client code to a server code of a module form contextually and non-contextually.

Upon non-contextual control transfer, only data that is explicitly specified by a developer in procedure or function parameters with the &AtServerNoContext compilation directive is transferred to the server.

Upon non-contextual control transfer to the server, in addition to procedure or function parameters with the &AtServer compilation directive, form data that was modified on the client starting from the previous context server call (see Appendix below) is transferred. Some additional actions are performed on the server to initialize form methods and a server copy of the form data. This can increase total time needed for the server to process the called procedure or function.

2. Use contextual control transfer if:

  • 1C:Enterprise platform optimizes the volume of data transferred between the client and the server in both directions. First of all, these are form attributes with spreadsheet documents and item collections (FormDataCollection, FormDataStructureAndCollection, and FormDataTree). See also: Using the FormDataCollection object.
  • Resources needed for the server to initialize the form context are justified by the significantly lower traffic between the client and the server and the lower number of server calls. 

In other cases, it is recommended that you use non-contextual control transfer from the client to the server.

3. When transferring control from the client to the server, it is unacceptable that you use the FormDataStructure, FormDataCollection, FormDataStructureAndCollection, FormDataTree, and SpreadsheetDocument objects as function parameters being passed by value. When transferring these types by value, a full object copy rather than only the changed data is transferred from the client to the server.
You need to work with these object types on the server. To do this, switch from the client to the server using an explicit context server call.
Incorrect example:

// Form module

&AtClient
Procedure CanceledOrderLinesCount()
  LinesCount = CommonModuleServerCall.CanceledLinesCount(Object.Goods);   // Suboptimal transfer of the "Goods" tabular section to the server
EndProcedure

// Common server module CommonModuleServerCall

Function CanceledLinesCount(TabularSection);
  FoundRows = TabularSection.FindRows(New Structure("Canceled", True));
  Return FoundRows.Count();
EndFunction

Correct:

// Form module

&AtClient
Procedure CanceledOrderLinesCount() 
LinesCount = CanceledLinesCount(); // The "Goods" tabular section is transferred implicitly by platform, in the optimal way
EndProcedure

&AtServer
Procedure CanceledLinesCount()
  Return CommonModuleServerCall.CanceledLinesCount(Object.Goods); // The server-server call without additional overhead expenses
EndProcedure

// Common server module CommonModuleServerCall

Function CanceledLinesCount(TabularSection);
  FoundRows = TabularSection.FindRows(New Structure("Canceled", True));
  Return FoundRows.Count()
EndFunction

Appendix

Upon contextual control transfer to the server, the following rules are applied in 1C:Enterprise platform to transfer changed form data between the client and the server:

  • Values of the FormDataStructure form attributes are transferred entirely if at least one of the attributes is changed. 
  • For objects of the FormDataCollection, FormDataStructureAndCollection, and FormDataTree types, changes are considered with a precision of up to each collection item, only changed items are transferred. Changed collection items are transferred entirely. See also: Using the FormDataCollection object.
  • For objects of the SpreadsheetDocument type, only changed regions are transferred.
  • Objects of the DynamicList type are not transferred.

See also:

  • Creating form modules
© 2020 1C INTERNATIONAL LLC www.1Ci.com Support policy