Desktop version

Main > Forum > 1C:Enterprise Platform > Studying 1C:Enterprise platform > Check attribute filling

Forum

Search UsersRules
Check attribute filling
#1
Active user
Points:: 0
Joined:: Jul 18, 2012

Hi! Could someone help to understand: I need to check if an attribute in each row of the tabular section is filled?
I'm trying to use the following code:

Code
Procedure OnWrite(Cancel)
    For Each CurRow In Items Do
        If CurRow.Item <> Catalogs.Items Then 
            UserMessage = New UserMessage;
            UserMessage.Text = "Item is not filled";
            UserMessage.Message();
            Cancel = True;
        EndIf;
    EndDo;
EndProcedure

But this cancels write every time.

Profile
#2
Active user
Points:: 32
Joined:: Sep 16, 2011

Hello, Lies, you must use ValueIsFilled() for that, here is an example:

Code
Procedure OnWrite(Cancel)
    For Each CurRow In Items Do
        If Not ValueIsFilled(CurRow.Item) Then 
            UserMessage = New UserMessage;
            UserMessage.Text = "Item is not filled";
            UserMessage.Message();
            Cancel = True;
        EndIf;
    EndDo;
EndProcedure

Profile
#3
Interested
Points:: 15
Joined:: Oct 27, 2011

You can use FillCheckProcessing.

It is a standard mechanism.

Here is an example

Code
Procedure FillCheckProcessing(Cancel, CheckedAttributes)
   For Each Bien In Bienes Do
      If Bien.CuentaDeBienes.AccountType = PredefinedValue("Enum.AccountTypes.Inventory") Then
         CheckedAttributes.Add("Bodega");
         Break;
      EndIf;
   EndDo;
   If DocumentosDePago.Count() > 0 Then
      CheckedAttributes.Add("CuentaDeAnticipo");
   EndIf;
EndProcedure

Profile
#4
Active user
Points:: 0
Joined:: Jul 18, 2012

Good idea, Alexey! And thank you, Samuel!

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.