D
D
Danil2018-12-11 18:10:03
1C
Danil, 2018-12-11 18:10:03

How to access document form fields in 1C:Enterprise 8.2?

Hello, I have a task: to calculate the student's annual grade in the document based on the results of his work in each quarter. It is clear that you just need to calculate the arithmetic mean, which would not seem difficult at all, but those very BUT appeared.
To do this, you need to refer to the "Annual" field and assign it an expression like ("I quarter" + "II quarter" + "III quarter" + "IV quarter") / 4. BUT how to access these fields?
In an attempt to find an answer, I went through various forums and found a code that could more or less suit me, but I had to change it, since it refers to slightly different data.
Here is the code I wrote:

&НаКлиенте
Процедура СписокНоменклатурыIчетвертьПриИзменении(Элемент)
  Стр=Элементы.СписокНоменклатуры.ТекущиеДанные;
  Стр.Годовая = (Стр.Iчетверть+Стр.IIчетверть+Стр.IIIчетверть+Стр.IVчетверть)/4;
КонецПроцедуры

&НаКлиенте
Процедура СписокНоменклатурыIIчетвертьПриИзменении(Элемент)
  Стр=Элементы.СписокНоменклатуры.ТекущиеДанные;
  Стр.Годовая = (Стр.Iчетверть+Стр.IIчетверть+Стр.IIIчетверть+Стр.IVчетверть)/4;
КонецПроцедуры

&НаКлиенте
Процедура СписокНоменклатурыIIIчетвертьПриИзменении(Элемент)
  Стр=Элементы.СписокНоменклатуры.ТекущиеДанные;
  Стр.Годовая = (Стр.Iчетверть+Стр.IIчетверть+Стр.IIIчетверть+Стр.IVчетверть)/4;
КонецПроцедуры

&НаКлиенте
Процедура СписокНоменклатурыIVчетвертьПриИзменении(Элемент)
  Стр=Элементы.СписокНоменклатуры.ТекущиеДанные;
  Стр.Годовая = (Стр.Iчетверть+Стр.IIчетверть+Стр.IIIчетверть+Стр.IVчетверть)/4;
КонецПроцедуры

And this is how the form looks like:
5c0fce31838b6664571348.png
Everything would be fine, but apparently I'm accessing this data incorrectly and therefore I can't work with it. Can you tell me what should I change in my code?
Here is the source from where I tried to find the solution:

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kinash, 2018-12-11
@OnlyGoRush

First, what is a nomenclature list? Delete all nafig.
Next, in the form module, write only one procedure, the call of which write to all your four fields in the first of the handlers - OnChange:

&НаКлиенте
Процедура ОценкаЧетвертиПриИзменении(Элемент)
  Объект.Годовая = (Объект.Iчетверть+Объект.IIчетверть+Объект.IIIчетверть+Объект.IVчетверть)/4;
КонецПроцедуры

Actually everything :)

G
GZamza, 2018-12-11
@GZamza

It should be like this:
&At the Client
Procedure Nomenclature List IV Quarter On Change (Item)
Elements.Annual = (Items. I Quarter + Elements. II Quarter + Elements. III Quarter + Elements. IV Quarter) / 4;
EndProcedure

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question