Answer the question
In order to leave comments, you need to log in
1C how to change all values of one column in "Nomenclature" table?
1C-Enterprise 8.3. I tried to change the values of the "VAT rate" column in the "Nomenclature" table to "Without VAT", in the absence of groupings and working with the entire column, I decided to write a script, I managed to get the column value, and the number of records + the value that needs to be recorded, but I ran into the following: the Write() function; swears at the lack of a method or something like that.
Here is the listing:
Procedure SetOnServer()
Request = New Request;
Query.Text = "SELECT
| Nomenclature.VAT Rate AS VAT Rate1,
| Nomenclature.VAT Rate.Reference,
| Nomenclature.VAT Rate.Order
|FROM
| Reference.Nomenclature AS Nomenclature
|TO CHANGE";
Selection=Request.Execute().Upload();
//CurrentRecord = Directory.Nomenclature.CreateRecordManager();
For each Row from Selection Loop
Document = Row;
Document.VAT Rate1 = Transfers.VAT Rates.Without VAT;
Notify(Document. VAT Rate1);
Write();
EndCycle;
EndProcedures
and screenshots:
How to update/save/record this unfortunate "Without VAT" in all fields of the column ?
Before that, I had never worked with 1C and I could not find adequate documentation
Answer the question
In order to leave comments, you need to log in
Fast decision. Start group processing of directories and documents (processing that is available in all standard configurations in both the normal and managed interface options), select the type reference nomenclature, apply a selection if necessary, and change the attribute value for all elements.
The path of the programmer. It is necessary to select by request not the properties of the VAT rate from the stock list directory, but links to the elements of the directory (with the selection that this is not a group). Then, by selecting from the request, you get the object by reference, replace the VAT rate and write it back to the database. Looks like this:
Запрос = Новый Запрос("Выбрать Ссылка Из Справочник.Номенклатура Где не ЭтоГруппа");
Выборка = Запрос.Выполнить().Выбрать();
Пока Выборка.Следующий() Цикл
Товар = Выборка.Ссылка.ПолучитьОбъект();
Товар.СтавкаНДС = Перечисления.СтавкиНДС.БезНДС;
Товар.Записать();
КонецЦикла;
I will add Dmitry that you have had a substitution of concepts. The Nomenclature Directory is one entity, and one of the attributes of this entity "VAT Rate" is, in fact, a link to another entity.
Imagine that you have two tables:
1. Person[Id, Name, Gender] - here the "Gender" field is the Foreign Key to gender table #2
2. Gender[id, Name] The
task is to overwrite the person's gender. You simply go through the elements of the "Gender" table without regard to the elements of the "Person" table you need.
Ah and further Dmitry already told.
Those. you need to start from the fact that you need to overwrite the element of the "Directory. Nomenclature" entity, respectively, and you need to select a link to it and work with it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question