locked
Lightswitch total order of a day week RRS feed

  • Question

  • Hello

    Can some one help me to create a query that give me the total number of order in a specific day of the week

    for example 12 orders in monday , 5 in friday  etc 

    Im tryng use the dateorder.dayofweek but it doesn't work, it gives me an error

    thanks


    Tuesday, October 28, 2014 5:06 PM

Answers

  • You can create queries and save them to the model of your application. You can then specify your search criteria by using the query designer. If the query designer does not provide the functionality that you need, you can extend the queries by writing some code. When you have specified your criteria, consume the queries in a screen or run them as part of your business logic.

    try this kind of method: http://msdn.microsoft.com/library/vstudio/ee256728.aspx


    Software Engineer | MCPD: Windows Phone Developer | MCTS: Silverlight Developer

    • Marked as answer by Angie Xu Monday, November 10, 2014 1:39 AM
    Tuesday, November 4, 2014 5:45 AM

All replies

  • Hi,

    You could try to add a sql query to lightswitch application. You could query the order.count where date=datetime.now(or something else).

    To extend a query by using code,you could follow below steps:

    1.Open a query in the Query Designer.

    2.In the Properties window, click Edit Additional Query Code.

    3.Customize the query by adding code to this method.

    For more information ,you could refer to link below:

    http://msdn.microsoft.com/en-us/library/ff852040.aspx

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    Wednesday, October 29, 2014 2:25 AM
  • hello,

    I tryed that but its like .DayOfWeek send an error because is not  part of LINQ

    this is the code

              Dim mondays = From Q In Me.DataWorkspace.ApplicationData.Appuntamentis Where Q.StartTime.DayOfWeek = 6 

                Dim recordCount As Integer

                recordCount = mondays.Execute().Count

                Me.TotalMonday = recordCount

     

    or this one

              Dim mondays = From Q In Me.DataWorkspace.ApplicationData.Appuntamentis Where Q.StartTime.DayOfWeek = 6 

               

                Dim SumMonday = Aggregate Wn In mondays.Execute() Into Sum(Wn.giornodellasettimana)

    ' giornodellasettimana is a computed row = result = appuntamenti.starttime.dayofweek         

                Me.TotalMonday = SumMonday

    Wednesday, October 29, 2014 8:31 AM
  • You can create queries and save them to the model of your application. You can then specify your search criteria by using the query designer. If the query designer does not provide the functionality that you need, you can extend the queries by writing some code. When you have specified your criteria, consume the queries in a screen or run them as part of your business logic.

    try this kind of method: http://msdn.microsoft.com/library/vstudio/ee256728.aspx


    Software Engineer | MCPD: Windows Phone Developer | MCTS: Silverlight Developer

    • Marked as answer by Angie Xu Monday, November 10, 2014 1:39 AM
    Tuesday, November 4, 2014 5:45 AM