StrataFrame Forum

Browse Dialog Left Join

http://forum.strataframe.net/Topic29011.aspx

By Marcio Valerio Silva - 11/17/2010

I created a view and a Business object for it. So I Drag a Business Object named CtaReceber to my form to bind the text box.

Until here is perfect the work, So I drag other BO named CtaReceberView that have the following code:



Select ctareceber.CtaReceberId, ctareceber.CtareceberNum,

ctareceber.CtaReceberParcela, ctareceber.CtaReceberTotParcela,

ctareceber.CtaReceberDtVcmto, ctareceber.CtaReceberNossoNumero,

clientes.clientesnome, portadores.PortadoresDescricao

From ctareceber

LEFT JOIN clientes on ctareceber.clientesId = clientes.ClientesId

LEFT JOIN portadores on ctareceber.PortadoresId = portadores.PortadoresId;



The Dialog Form is perfect but I dont know how to receive the Key from Browse Dialog to Navigated my first BO to position Chosed by Browse Dialog. So I Tryed:



private void browseDialog1_BrowseDialogClosed(MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogClosedEventArgs e)

{

int _pk = searchCtaReceberBO1.CtaReceberId;

if (ctaReceberBO1.SeekToPrimaryKey(searchCtaReceberBO1.CtaReceberId))

ctaReceberBO1.NavigateToPrimaryKey(searchCtaReceberBO1.CtaReceberId);

}



But th result don´t work and I need a lot to do this in whole my system.

If somebody Know to do, Please help-me!

I have a urgency about this.

at,

Marcio Valerio
By Ivan George Borges - 11/18/2010

Go to the Business Object Mapper. Right-click your view BO and then choose properties. When you defined your view, you should have a primary key added to it. Then, on the Business Object Properties dialog, make sure you set the "Override Primary Key Specification" to the field you want to be this view primary key:



Once you have done that and built the partial, go to your form's BrowseDialog and add the BrowseDialogClosed event handler. In it, write code to get the primary key and do whatever you need with it:

    Private Sub MyBrowseDialog_BrowseDialogClosed( _
      ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogClosedEventArgs) _
      Handles MyBrowseDialog.BrowseDialogClosed
        If e.Reason = MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogClosedReasons.UserCancelled Then
            Exit Sub
        End If

        '-- establish locals
        Dim lnChosenPk As Integer

        '-- get the chosen record PK
        lnChosePk = Me.MyViewBO1.MyPrimaryKey
    End Sub
By Marcio Valerio Silva - 11/18/2010

Hi Ivan,

Now it´s work perfectly!

God Blessing you!

at,

Marcio Valério
By Ivan George Borges - 11/18/2010

Really glad it is working, Marcio.

You are most welcome. Cool