Hi. When I post the data I have inserted in the debugger, I'm having this message. Value is not of object type (Description)
Error running processor - 'Posting' , reason: {Document.Services.ObjectModule(55)}: Value is not of object type (Description) MessageText = Value is not of object type (Description)
And here is the section of my Query in the posting handler. While SelectionDetailRecords.Next() Do MessageText = MessageText + Chars.CR + Chars.LF + SelectionDetailRecords.ComputerEquipments.Description + ": " + (after SelectionDetailRecords. it does not find ComputerEquipments automatically so I have inserted manually. SelectionDetailRecords.QuantityBalance; EndDo;
I'm new in 1C development so I would appreciate any help even it seems an easy question to ask.
Dear Abbas, please share with us more code you use. What is the object SelectionDetailRecords? Is this a query selection result ? Please provide query code.
Thanks for viewing my post. Here is the full code. SelectionDetailsRecords is query selection yes. Query is reading from the SelectTable and execute the message based on the value assigned for either <0 or equal to 0. I'm especially having an error on the highlighted part I have mentioned below. Similar training version of this code can also be found here https://yellow-erp.com/page/guides/1cprofessional-training-course/lesson-2-5/
Procedure Posting(Cancel, Mode) //{{__REGISTER_REGISTERRECORDS_WIZARD // This fragment was built by the wizard. // Warning! All manually made changes will be lost next time you use the wizard.
// register ComputerEquipmentBalance Expense
RegisterRecords.ComputerEquipmentBalance.Write = True; For Each CurRowEquipmentorService In EquipmentorService Do If CurRowEquipmentorService.Item = Enums.EquipmentorService.Services Then Continue; EndIf;
//2. Writing down BalanceOfMaterials recordset RegisterRecords.ComputerEquipmentBalance.LockForUpdate = True; RegisterRecords.Write();
//3. Checking if there any negative balance records Query = New Query; Query.Text = "SELECT | ComputerEquipmentBalanceBalance.ComputerEquipments AS ComputerEquipments, | ComputerEquipmentBalanceBalance.Warehouse AS Warehouse, | ComputerEquipmentBalanceBalance.QuantityBalance AS QuantityBalance |FROM | AccumulationRegister.ComputerEquipmentBalance.Balance AS ComputerEquipmentBalanceBalance |WHERE | ComputerEquipmentBalanceBalance.QuantityBalance < 0";
// 4. If the result is not empty, cancel the document's posting If SelectionDetailRecords.Count() = 0 Then Return; EndIf;
Cancel = True;
//Prepare the error message an MessageText = MessageText = "There is not enough equipments on the " + ThisObject.Warehouse.Description + ". See the list of deficits below:" + MessageText; While SelectionDetailRecords.Next() Do MessageText = MessageText + Chars.CR + Chars.LF + SelectionDetailRecords.ComputerEquipments.Description + ": " + SelectionDetailRecords.QuantityBalance; Enddo;
I would really appreciate if you have a look into my configuration. It is a link to the reference in which it calculates the overall and sends to the EquipmentBalance Field.
I checked your configuration. You are using string data type in ComputerEquipments and Warehouse fields. And therefore you get an error message as string is simple datatype and does not have attributes like Descriptions, etc. You need to change datatype to catalogs Computer equipment and warehouse respectively.