I
I
Ivan2019-10-13 10:15:35
1C
Ivan, 2019-10-13 10:15:35

How to select a field from a query?

Have a request

Query.Text =
"SELECT
| Nomenclature Prices.Nomenclature.Parent,
| Nomenclature Prices.Nomenclature.DescriptionFull,
|Nomenclature Prices.Price
|FROM
| Information Register.Nomenclature Prices AS Nomenclature Prices";

How to select "Parent" and "NameFull" from this query.
With such a record, it swears that it cannot find the "Nomenclature" field
While SelectionDetailRecords.Next() Loop
NewRecord = New Structure("Parent, Name, Price");
NewRecord.Parent = String(SelectionDetailedRecords.Nomenclature.Parent);
NewRecord.Name = String(SelectionDetailedRecords.Nomenclature.NameFull);
NewRecord.Price = String(SelectionDetailedRecords.Price);
DataArray.Add(NewRecord);
EndCycle;

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin, 2019-10-13
@fosihas

1. put a debugging point. This will help you see what you can refer to in the SampleDetailRecords and what names there are.
well, or look in the request
2. what do you select in the request? Is there any mention of nomenclature? You choose the Parent and NameFull, so write them SamplingDetailedRecords.Parent, SamplingDetailedRecords.NameFull.

K
Konstantin Nagibovich, 2019-10-13
@nki

Make aliases to the fields and refer to them. For example:

ВЫБРАТЬ
| ЦеныНоменклатуры.Номенклатура.Родитель КАК Родитель

By name Parent you will get access to the field.

D
Do_it, 2019-10-13
@Do_it

Since there are no aliases in the query, the fields in the SamplingDetailRecords will be called "Nomenclature Parent" and "NomenclatureDescriptionFull". In general, they wrote it correctly above - it was necessary to put a breakpoint after While SelectionDetailedRecords.Next() Loop and see what is in the selection

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question