Detect new record in a form


Author
Message
Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
Hi Ivan,

In the SF Maintenance form, How do we know the current form's record is new and then return me boolean ?



Please advice
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Tiong.

Have a look at the BO's EditingState property.

EditingState Property

All StrataFrame business objects have an EditingState property.  This property indicates the current state of the business object, and there are three valid states:
  • Idle - When a business object is not in Add or Edit mode, it is in an idle state.  When bound to controls and the editing state are managed by StrataFrame, the fields bound to a business object in this state will be disabled.

  • Adding - The current row within the business object is new.  Additionally, all fields bound to the business object, when managed by StrataFrame, will be enabled.

  • Editing - The current row within the business object is an existing record that is being modified.  All fields bound to the business object, when managed by StrataFrame, will be enabled.


Edited 14 Years Ago by Ivan George Borges
Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
Hi Ivan,

You had help me again with your solution.


Thanks
Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
Hi Ivan,

Your solution still can't work when i test it. I did it with my own solution and please advice


 Private Sub ComboBox1_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Validated
        If isnew = True Then
            Textbox1.Text = modEmployee.careerhis_sequence_increment(BO_hretCareerHis1.iChsEmployee_FK)
        End If

        'If MicroFour.StrataFrame.Business.BusinessEditingState.Adding Then
        '    Textbox1.Text = modEmployee.careerhis_sequence_increment(BO_hretCareerHis1.iChsEmployee_FK)
        'End If
    End Sub


    Public Property isnew() As Boolean
        Get
            Return x
        End Get
        Set(ByVal Value As Boolean)
            x = Value
        End Set
    End Property


    Private Sub MaintenanceFormToolStrip1_ItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MaintenanceFormToolStrip1.ItemClicked
        If e.ClickedItem.Text = "New" Then
            isnew = True
        Else
            isnew = False
        End If
    End Sub



Thanks
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
You should test you BO's editing state. As in:

    If YourBO.EditingState = MicroFour.StrataFrame.Business.BusinessEditingState.Adding Then
        Textbox1.Text = modEmployee.careerhis_sequence_increment(BO_hretCareerHis1.iChsEmployee_FK)
    End If


Or you can use the BO's EditingStateChanged event and set your isnew property:

    Private Sub YourBO_EditingStateChanged(ByVal e As MicroFour.StrataFrame.Business.EditingStateChangedEventArgs) _
        Handles YourBO.EditingStateChanged

        If e.EditingState = MicroFour.StrataFrame.Business.BusinessEditingState.Adding Then
            isnew = True
        Else
            isnew = False
        End If

    End Sub

Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
Hi Ivan,

I did it with your solution.

Thanks
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
You are welcome, Tiong. Cool
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search