locked
Select Listbox item through code RRS feed

  • Question

  • When I show a details screen in code, I am able to pass an ID into it so it knows what item to show.

    Application.ShowInvoiceDetails(inv.Id)

    How can I do the same thing with a list? ie:

    Application.ShowInvoicesListDetails(inv.Id)


    Wednesday, October 30, 2013 10:53 PM

Answers

  • @Rabontech - By default a 'List and Details' screen does not require a parameter since is displays an entity collection. You can use Application.ShowInvoicesListDetails(); to open the screen.

    In case you want to add a required parameter to the screen then you can do so by:

    1. On InvoicesListDetail screen, click on 'Add data item'

    2. On 'Add Data Item' dialog, select local property (you can choose the type of property from the dropdown list) and name it as propperty1

    3. Click OK

    4. Select 'Property1' and check the 'Is Parameter' checkbox on the property sheet.

    Now you would be able to add a parameter to ShowInvoiceListDetails

    Thanks

    Rohit

    Thursday, October 31, 2013 12:30 AM

All replies

  • @Rabontech - By default a 'List and Details' screen does not require a parameter since is displays an entity collection. You can use Application.ShowInvoicesListDetails(); to open the screen.

    In case you want to add a required parameter to the screen then you can do so by:

    1. On InvoicesListDetail screen, click on 'Add data item'

    2. On 'Add Data Item' dialog, select local property (you can choose the type of property from the dropdown list) and name it as propperty1

    3. Click OK

    4. Select 'Property1' and check the 'Is Parameter' checkbox on the property sheet.

    Now you would be able to add a parameter to ShowInvoiceListDetails

    Thanks

    Rohit

    Thursday, October 31, 2013 12:30 AM
  • I was under the impression a parameter was used to limit the choices on a list, not select them.

    I'm trying as you suggested, but I'm not getting the desired result. 

    What I have is a details screen with a method that creates a new invoice with the screen details. Once the invoice is created, I want to display the InvoicesListDetails screen, and automatically go to the invoice that was just created, as opposed to just selecting the first item on the list. 

    Is this functionality possible?

    Edit:

    Figured it out! Just had to tell it to activate the passed Id. 

    Private Sub InvoicesListDetail_Activated()
                ' Write your code here.
                If Me.Invoices.SelectedItem IsNot Nothing Then
                    If Me.InvoiceId IsNot Nothing Then
                        For Each inv In Me.Invoices
                            If inv.Id = InvoiceId Then
                                Me.Invoices.SelectedItem = inv
                            End If
                        Next
                    End If
                End If
            End Sub

    • Edited by thatITguyfromGA Thursday, October 31, 2013 4:30 AM
    • Proposed as answer by joshbooker Wednesday, January 15, 2014 11:46 PM
    Thursday, October 31, 2013 4:11 AM