Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Date Range Report (Video to Share)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Re: Date Range Report (Video to Share)

    Great screencast. Definitely helped out with my date ranges for my reports.

    Comment


      #17
      Re: Date Range Report (Video to Share)

      Thanks for sharing.

      Wish there was a video for doing the same thing using a DBF backend.
      Sergeant Richard Hartnett
      Hyattsville City Police Department
      Maryland

      Comment


        #18
        Re: Date Range Report (Video to Share)

        Thank you Lee and Chad for these. They are great.

        One question. Is there a way to add a drop down so the user can use the sort function?

        I have a report that lists products. I am using the formats that are outlined in the screencasts and they work great. Now the user wants the ability to sort the report by SKU, Product Description or Product Type. It doesn't appear that I can use an argument in the MySQL order by command.

        Any one have have any thoughts?

        Thanks,
        Mike Reed
        Phoenix, AZ

        Comment


          #19
          Re: Date Range Report (Video to Share)

          Outstanding guys. This is exactly what makes this place so great, everyone is so willing to share and help others.
          Thanks Lee & Chad ... fantastic stuff!
          Alpha Anywhere v12.4.6.5.2 Build 8867-5691 IIS v10.0 on Windows Server 2019 Std in Hyper-V

          Comment


            #20
            Re: Date Range Report (Video to Share)

            You should be able to do that with the sql order area using the arguments the same way that you use the arguments for the filter. You may need to remove any order clauses from the report as it may try to override the argument.
            Chad Brown

            Comment


              #21
              Re: Date Range Report (Video to Share)

              Originally posted by chadbrown View Post
              You should be able to do that with the sql order area using the arguments the same way that you use the arguments for the filter. You may need to remove any order clauses from the report as it may try to override the argument.
              FWIW

              Removing the order clauses isn't the only option.

              Sometimes the ordering options of the report are needed to build group headers and footers.

              If the data is already in the order needed, then the option to use set ordering won't resort the data, but will use the data in the order provided.

              This is a really powerful option and can give strange results when applied if you're unaware of how it works.

              It can also be applied for creative results as needed.
              Al Buchholz
              Bookwood Systems, LTD
              Weekly QReportBuilder Webinars Thursday 1 pm CST

              Occam's Razor - KISS
              Normalize till it hurts - De-normalize till it works.
              Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
              When we triage a problem it is much easier to read sample systems than to read a mind.
              "Make it as simple as possible, but not simpler."
              Albert Einstein

              http://www.iadn.com/images/media/iadn_member.png

              Comment


                #22
                Re: Date Range Report (Video to Share)

                If I use this code, then the list is ordered properly:

                SELECT product.PROD_ID, product.ACTIVE, product.PRODUCT, product.CATEGORY, product.SKU, product.UOM, product.SVC_TYPE, product.PAY, product.UNITPRICE, product.DISTRICT, product.COM_ID, product.MGMTCODE, complex.COMPLEX, complex.ACTIVE AS ACTIVE1
                FROM product product
                INNER JOIN complex complex
                ON product.COM_ID = complex.COM_ID
                ORDER BY product.SKU

                If I use this code; ie using arguments, then it does not work, the list comes back, but is not sorted.

                args.set("orderby","product.sku")

                SELECT product.PROD_ID, product.ACTIVE, product.PRODUCT, product.CATEGORY, product.SKU, product.UOM, product.SVC_TYPE, product.PAY, product.UNITPRICE, product.DISTRICT, product.COM_ID, product.MGMTCODE, complex.COMPLEX, complex.ACTIVE AS ACTIVE1
                FROM product product
                INNER JOIN complex complex
                ON product.COM_ID = complex.COM_ID
                ORDER BY :orderby

                This is for MySQL.

                thanks,
                mike
                Mike Reed
                Phoenix, AZ

                Comment


                  #23
                  Re: Date Range Report (Video to Share)

                  Is there an order or grouping on the report as Al has said?
                  Chad Brown

                  Comment


                    #24
                    Re: Date Range Report (Video to Share)

                    Originally posted by chadbrown View Post
                    Is there an order or grouping on the report as Al has said?
                    Since the SQL works without arguments, I thinking that the issue is more in the definition of the args or the execution of the sql .

                    Show us more of the code you are using - from the argument's dim statement to the .execute of the SQL
                    Al Buchholz
                    Bookwood Systems, LTD
                    Weekly QReportBuilder Webinars Thursday 1 pm CST

                    Occam's Razor - KISS
                    Normalize till it hurts - De-normalize till it works.
                    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                    When we triage a problem it is much easier to read sample systems than to read a mind.
                    "Make it as simple as possible, but not simpler."
                    Albert Einstein

                    http://www.iadn.com/images/media/iadn_member.png

                    Comment


                      #25
                      Re: Date Range Report (Video to Share)

                      No the report does not have any filter or orderby. Actually, it doesn't seem to make any difference whether there is a report or not.
                      Here is code and response from the interactive window. Note that the first response is correct, but when done with an argument, it is not. Trying to sort by the SKU.

                      dim cn as sql::Connection
                      dim args as sql::Arguments

                      cn.Open("::Name::MySQL")
                      qry = <<%A%
                      SELECT product.SKU, product.PROD_ID, product.ACTIVE, product.PRODUCT, product.CATEGORY, product.UOM, product.SVC_TYPE, product.PAY, product.UNITPRICE, product.DISTRICT, product.COM_ID, product.MGMTCODE, complex.COMPLEX, complex.ACTIVE AS ACTIVE1
                      FROM product product
                      INNER JOIN complex complex
                      ON product.COM_ID = complex.COM_ID
                      ORDER BY product.sku
                      %A%
                      ?cn.Execute(qry)
                      = .T.

                      rs = cn.ResultSet
                      ?rs.ToString()
                      = 1 BDRM CRCH 34323 T 1 BDRM PAINT + LIDS COLOR CHAN Painting Service - Interior Painting EA PA 120 200 LV L2077
                      1 BDRM CRCH 34373 T 1 BDRM PAINT + LIDS COLOR CHAN Painting Service - Interior Painting EA PA 120 200 LV L781
                      151-2TCCPLG1 28979 T painted kitchen/bath cabinets Painting Service - Interior Painting EA PA 75 150 DA D155
                      151-PL1 28981 T 1 bdrm full paint Painting Service - Interior Painting EA PA 0 85 DA D155
                      1BDRM REHAB 43197 T 1 BDRM REHAB PAINT Painting Service - Interior Painting EA PA 0 325 LV L217
                      1BW 30203 F One Bedroom White Paint+ Paint Painting Service - Interior Painting EA PA 40 145 LV L712
                      1cl 33802 T One bedroom clean Cleaning - Units EA CL 40 80 LV L2575
                      1CP+P 32120 F 1 Bedroom Ceiling Paint + Paint Painting Service - Interior Painting EA PA 20 70 LV L2282
                      1CPMAT 27071 T 1 Bdrm Ceiling Paint Material Painting Service - Interior Painting EA PA 0 10 HO H223


                      args.Set("orderby","product.sku")
                      qry = <<%A%
                      SELECT product.SKU, product.PROD_ID, product.ACTIVE, product.PRODUCT, product.CATEGORY, product.UOM, product.SVC_TYPE, product.PAY, product.UNITPRICE, product.DISTRICT, product.COM_ID, product.MGMTCODE, complex.COMPLEX, complex.ACTIVE AS ACTIVE1
                      FROM product product
                      INNER JOIN complex complex
                      ON product.COM_ID = complex.COM_ID
                      ORDER BY :orderby
                      %A%
                      ?cn.Execute(qry,args)
                      = .T.

                      rs = cn.ResultSet
                      ?rs.ToString()
                      = MGR 26916 T SUBCONTRACTED MANAGER Admin EA ZZ 1200 0 AD A1073
                      ADV 27549 T Advance Pay To Subcontractor for tools Advance EA AV 50 0 PH A1073
                      RM 33745 T Reimburse For Expenses Maintenance - General EA AD 0 0 AD A1073
                      REDO 34563 T Redo - Paint Painting Service - Interior Painting EA PA -1 0 AD A1073
                      REDO 36130 T Redo - Cleaning Cleaning - Other EA CL -1 0 AD A1073
                      REDO 37791 T Redo - Drywall Maintenance - Drywall EA DR -1 0 AD A1073
                      REDO 39491 T Redo - Maintenance Maintenance - General EA MA -1 0 AD A1073
                      Mike Reed
                      Phoenix, AZ

                      Comment


                        #26
                        Re: Date Range Report (Video to Share)

                        is there anything noted in cn.CallResult.text when the results aren't sorted?

                        Or is there somewhere else to look for sql errors?

                        Can we look at the SQL that was executed to see what the actual SQL is when the argument values are substituted?
                        Al Buchholz
                        Bookwood Systems, LTD
                        Weekly QReportBuilder Webinars Thursday 1 pm CST

                        Occam's Razor - KISS
                        Normalize till it hurts - De-normalize till it works.
                        Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                        When we triage a problem it is much easier to read sample systems than to read a mind.
                        "Make it as simple as possible, but not simpler."
                        Albert Einstein

                        http://www.iadn.com/images/media/iadn_member.png

                        Comment


                          #27
                          Re: Date Range Report (Video to Share)

                          Originally posted by Al Buchholz View Post
                          is there anything noted in cn.CallResult.text when the results aren't sorted?

                          Or is there somewhere else to look for sql errors?

                          Can we look at the SQL that was executed to see what the actual SQL is when the argument values are substituted?
                          1. When I run it, with or without the sort or argument, this is the result
                          ?cn.CallResult.Text
                          = "Success"

                          2. I don't know where else to look, but I am certainly open to suggestion

                          3. I'm not sure what you mean here. How would I look at the actual SQL?

                          Thanks for your help.

                          Mike
                          Mike Reed
                          Phoenix, AZ

                          Comment


                            #28
                            Re: Date Range Report (Video to Share)

                            The problem is the way that Alpha resolves the argument. Since it is a character value, Alpha wraps it in quotes when it resolves.
                            To use it in the order clause, where MySQL is expecting a non quoted field value, you need to do something to get the value without the quotes. There are a couple of ways. Below is an example showing the problem and one way how to overcome it in a SQL statement.

                            Code:
                            dim args as sql::Arguments
                            dim cn as sql::Connection
                            dim rs as sql::ResultSet
                            dim text as c = "text"
                            dim a as c
                            dim b as c
                            args.Set("order",text)
                            dim sql as c = <<%txt%
                            select * from tasks  where 1=1 order by :order
                            %txt%
                            
                            ?sql
                            = select * from tasks  where 1=1 order by :order
                            
                            b  = replace_arguments_in_string(sql,args)
                            
                            'the problem is the double quotes around the column name "text"
                            ?b 
                            = select * from tasks  where 1=1 order by "text"
                            
                            'use the .find() method to get the actual value of the argument.
                            sql = "select * from tasks order by "+ args.find("order").data
                            ?sql
                            = "select * from tasks order by text"
                            
                            cn.Open("::Name::Access_gantt")
                            if .not. cn.Execute(sql,args) then
                            	msgbox("error", cn.CallResult.text)
                            	cn.Close()
                            	end
                            end if
                            cn.PortableSQLEnabled = .t.
                            cn.TraceSQL = .t.
                            rs = cn.ResultSet
                            cn.Close()
                            a = rs.tostring()
                            'now the order clause will resolve correctly (text is the second column)
                            ?a
                            = 68	Access Gantt	11/28/2013 12:00:00 00 am	2	0	1	0	0	My test                                                                                                                                                                                                                                                        
                            67	custom task	11/28/2013 12:00:00 00 am	1	0	1	0	0	Custom Column                                                                                                                                                                                                                                                  
                            66	My test	11/27/2013 12:00:00 00 am	1	0.200772	1	0	0	UDC                                                                                                                                                                                                                                                            
                            69	New task	11/28/2013 12:00:00 00 am	1	0	1	0	0
                            Jim Coltz
                            Alpha Custom Database Solutions, LLC
                            A5CustomSolutions.com
                            [email protected]

                            Comment


                              #29
                              Re: Date Range Report (Video to Share)

                              Thanks for this info. I will work on this.
                              appreciate your help, Jim

                              mike
                              Mike Reed
                              Phoenix, AZ

                              Comment


                                #30
                                Re: Date Range Report (Video to Share)

                                hello

                                I think in MySQL you can use column number for order expression.
                                args.Set("orderby","product.sku")
                                so this can be written
                                args.set("orderby",1) since product.sku is the first column.
                                then try cn.execute(qry,args)
                                see if that gives the results you want.
                                thanks for reading

                                gandhi

                                version 11 3381 - 4096
                                mysql backend
                                http://www.alphawebprogramming.blogspot.com
                                [email protected]
                                Skype:[email protected]
                                1 914 924 5171

                                Comment

                                Working...
                                X