none
Open Detail Screen by entering article number in Modal Window RRS feed

  • Question

  • Hi,

    I like to open my detail screen by entering the for example the article number in a field in a modal window.

    First I added a screen with a modal window with a field where I can tip my article number and a ok button.

    I added to the ok button the code:

    Me.Application.show_Article(ID)
    

    Know my problem is, that I do not want to use the ID as parameter, I want to use my article number. Is it possible?

    I tried to find some option in the designer to enable the article number as query parameter instead of the ID.

    If it is not possible I think I have to search in my articleSet for the article number to get the ID. Now my question is, is there already a function to do this very quick or is the best way to do it with a loop? I want to know this because of performance of my application.

    Thanks.

    Markus

     

    Tuesday, September 6, 2011 11:05 PM

Answers

  • Try creating a query that uses the article number as the parameter and creating an edit/details screen that uses that query as it's data source. Then in you ok button call the new screen passing the parameter to it.
    http://www.virtualrealm.com.au - XNA Game Programming News and Resources from Downunder.
    • Proposed as answer by JaimeH Wednesday, September 7, 2011 12:46 AM
    • Marked as answer by Dragonalw Wednesday, September 7, 2011 6:13 AM
    Tuesday, September 6, 2011 11:08 PM

All replies

  • Try creating a query that uses the article number as the parameter and creating an edit/details screen that uses that query as it's data source. Then in you ok button call the new screen passing the parameter to it.
    http://www.virtualrealm.com.au - XNA Game Programming News and Resources from Downunder.
    • Proposed as answer by JaimeH Wednesday, September 7, 2011 12:46 AM
    • Marked as answer by Dragonalw Wednesday, September 7, 2011 6:13 AM
    Tuesday, September 6, 2011 11:08 PM
  • Hi,

    to create a edit/details screen and adding the query works fine. But I have one problem, I have a collection in my detail screen and I cannot add new entries to my collection by code. This does not work:

    Dim new entrie = Me.my_Collection.AddNew()
    
    


    The second problem is that I have to design a new Detail screen, it is not really a problem but it takes time.

    So I decided to try the following:

    'Execute my new Query
    Dim test = Me.DataWorkspace.ApplicationData.my_Query(article_number).Execute()
    'After executed the query I get the ID
    Dim ID = test.FirstOrDefault().Id
    'With the ID I can open my Detail Screen
    Me.Application.ShowAuftrag_Detail_Mechaniker(ID)
    

    But to execute the query takes some time.

    So I decided to loop through my table to get the ID:

    Dim ws = Me.Application.CreateDataWorkspace()
                
    Dim ID_Article
    
                
    Dim list = ws.ApplicationData.My_Set.GetQuery().Execute()
    
    
                For Each article In list
                    If article.number = Me.ArticleNumber Then
                        ID_Article = article.Id
                         Me.Application.ShowAuftrag_Detail_Mechaniker(ID_Article)
                    End If
                Next
    


    I tried it with the same entries and its much faster. If I have time I am going to try it with a few thousand entries to test the performance. I will post my result.

    Markus

     

    Wednesday, September 7, 2011 7:41 AM
  • The technique that you're using is not the right way.

    Have a look at Beth's videos:

    Visual Studio LightSwitch How Do I Videos

    There are two that should be particularly helpful, #3 & #9.


    Yann

    (plus ça change, plus c'est la même chose!)

    Wednesday, September 7, 2011 2:13 PM
    Moderator
  • Hi Yann,

    thanks. I watched the videos, but I do not know how to do it or what you mean.

    Maybe you can give me a tip.

    Markus

    Wednesday, September 7, 2011 3:23 PM