E
E
EvgenShal2021-05-25 15:56:01
1C-Enterprise
EvgenShal, 2021-05-25 15:56:01

How to automatically create variables in 1s?

Hello, help is required. For educational purposes, I create a configuration element, and the question arose of how to automatically create variables in the document form module according to the table filled in by the user?
There is a tabular part of two columns Designation and Value, it is required for each row of the table to create a variable with a name from the Designation column equal to the Value, respectively.
If there is no such method, then tell me how to apply the values ​​from the tabular part in the Calculate () operation?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kinash, 2021-05-26
@EvgenShal

The 1C language for forms has tools for creating new details and form elements, but not for code variables.
If you need to create a variable with an arbitrary name in the code, then you can use the Run() procedure, but you can access the values ​​of such a variable only from another code fragment for Run(), and when your procedure ends, all its local data is deleted, i.e. e. no recursions and sequential calculations by additional functions. Therefore, only one piece of programmatically generated code, which in the same way can be formed from calls to the rows and columns of your table - there is no sense in creating variables.
To solve your problem, it is better to create one variable of the Structure (or Correspondence) type, where the keys will be your variables from the form, and the values, respectively, will be their values.

K
Konstantin, 2021-05-25
@fosihas

Is this the kind of task?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question