Check attribute filling

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

#1
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Jul 18, 2012
Company:

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.

 
#2
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Sep 16, 2011
Company: individual

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

Edited: Samuel Harris - Aug 13, 2012 05:19 PM
 
#3
People who like this:1Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

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

 
#4
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Jul 18, 2012
Company:

Good idea, Alexey! And thank you, Samuel!

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.