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

Print Preview Filter Issues

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

  • Print Preview Filter Issues

    Hello, using the attached database as an example, is there a way if the user presses any one of the "print preview" buttons and the filtered data there requesting is not available, a message box would appear tell them this.

    Example: User presses "Print Preview Customer/City" and inputs "ZZ" for company name and "Dallas" for city, as it is now in the example database, a blank print preview window appears. I would like message box to appear saying "Your search for ZZ in Dallas return no records. Try Again??"

    Thank you in advance... JON
    Attached Files
    Last edited by jbk; 10-24-2011, 11:35 AM.

  • #2
    Re: Print Preview Filter Issues

    The general method is to use a5_get_records_in_query() with the report filter first and branch accordingly.
    There can be only one.

    Comment


    • #3
      Re: Print Preview Filter Issues

      Thanks Stan. Whats the chance's of you helping with the above code and placing it in my example? Newbie here...

      Comment


      • #4
        Re: Print Preview Filter Issues

        Changed the customer only button.

        Print Filter.zip
        There can be only one.

        Comment


        • #5
          Re: Print Preview Filter Issues

          Thank you sir... I see the code for single filter, now I'm trying to figure out how to make it work for multiple filters/parameters (customer/city) button.

          I would like a msg box if any or all the requested filters are not matching.

          Using my example, if user enters "Z" as customer and "Dallas" as city as the print preview parameters, there is no company "Z" but there is a "Dallas" but since the user wanted to filter by both customer and city a msg box would appear. But if user inputs "M" as city and "Dallas" the print preview would show all companies beginning with "M" that are in "Dallas".

          Once again thanks Stan...
          Last edited by jbk; 10-24-2011, 01:03 PM.

          Comment


          • #6
            Re: Print Preview Filter Issues

            Revised as suggested.

            Print Filter.zip
            There can be only one.

            Comment


            • #7
              Re: Print Preview Filter Issues

              jbk,

              It sounds to me as though you're trying to recreate the "query by form" functionality that's already built in. Why not use QBF, and then base your report on the currently selected records?

              -- tom

              ps. There's a big difference between a filter that says look for a customer named "M", and one that says look for all customer's who's lastname begins with "M". You've blurred the distinction in your posts.

              Comment


              • #8
                Re: Print Preview Filter Issues

                Thanks Stan for the update. After I received you first example, I went exploring and figured how to add other parameters. Now I have another issue I can't seem to make the filter by date range work. In the attached example, I have placed (2) buttons each labeled with there respective filter parameters. Top button (customer, city, date begin) works as expected, its the bottom button (customer, city, date begin & end) that's giving me the grief. Top button allows the user to choose (3) options to filter report. If user chooses to filter by just name and inputs "Mike" in name, report brings up "Mike's Accounting", if the user inputs "Dallas" in city(without Mike) report brings up I believe (4) results with customer in "Dallas". If user inputs "Mike" in name AND 05/01/11 in Date Begin, report brings up Mike's Accounting service call on 5/15/11. WORKS AS I WANT IT TO.....

                Now the bottom button.... If I input the same criteria as I did on top button, I get error message. If I enter "Mike" in name, 05/01/11 in date begin and 06/01/11 in date end it works properly. If I enter 6/01/11 in date end, if gives me all records prior to 6/1/11. It's forcing me to input data in the "Date End" field and I don't understand why. I want full freedom of how it searches. Whether that be by putting info in 1 or 4 fields. Was working just fine, now this.... Please help... Thank you in advance
                Attached Files

                Comment


                • #9
                  Re: Print Preview Filter Issues

                  You're having problems because you have one filter defined

                  Code:
                  filter = " (left(business_name,len([varC->prms.Parameter1])) = [varC->prms.Parameter1] )  .AND. (left(city,len([varC->prms.Parameter2])) = [varC->prms.Parameter2] )  .AND. (date >= [varD->prms.Parameter3]  )  .AND. (date <= [varD->prms.Parameter4]  )"
                  and all of those parameters must obtain some value but you only want to supply some of them.

                  What do you think gets into the end date if you don't specify it? I think it is a blank date {}. So the filter excludes all records with date fields > {}..................all of them.

                  You're going to have to have a filter for each possible combination of parameters supplied and use the one that fits..
                  There can be only one.

                  Comment


                  • #10
                    Re: Print Preview Filter Issues

                    If thats the case, why is the top button (name, city, date begin) working? Why isn't the filter excluding the records if the user just place info in 1 of 3 of the the filter selections (Name, City, Date Begin)

                    Comment


                    • #11
                      Re: Print Preview Filter Issues

                      Stan, attached is a workaround I done for the above issue with the bottom button (name, city, date begin & end). I still don't understand why this button is giving me issues and why the top button (name, city, date begin) allows the user to input data in just one field (ie entering "Mike" in top button brings up "Mike's Accounting" and user has the choice of then filtering reported data even further. My "workaround" uses the same filtering criteria as previously bottom button, but using Alpha Scripting, I was able to have a default date (12/31/2100). This allows the user to input "Mike" without having to input values for city or beginning date. My questions to you would be, is it possible to have this default date automatically entered (hidden in code) if user doesn't enter a date in "Date End". If it is possible, I would have the Date Begin be 1/1/1900 and the date end be 12/31/2100. This would satisfy everyone in my lifetime...

                      Not real crazy about the looks of the default date being shown in the dialog box.... JON

                      I
                      Attached Files

                      Comment


                      • #12
                        Re: Print Preview Filter Issues

                        You can set defaults like this.

                        Code:
                        'Prompt for parameter values. Store results in a 'dot' variable called 'prms'
                        dim prms as p 
                        prms = ui_get_parameters(dialog_title,get_parameters_string,ok_label,cancel_label)
                        if prms.last_button_pressed = "OK" then 
                        	if prms.parameter1 = ""
                        		prms.parameter1 = "Default value" 'whatever text you want here
                        	end if
                        	if prms.parameter2 = ""
                        		prms.parameter2 = "Default value" 'whatever text you want here
                        	end if
                        	if prms.parameter3 = {}
                        		prms.parameter3 = {01/01/2011} 'whatever date you want here
                        	end if
                        	if prms.parameter4 = {}
                        		prms.parameter4 = {12/31/2011} 'whatever date you want here
                        	end if
                        	'Replace parameters in the filter with actual values
                        	query.filter = replace_parameters(filter,local_variables())
                        	
                        	query.order = ""
                        else
                        	end
                        end if
                        There can be only one.

                        Comment


                        • #13
                          Re: Print Preview Filter Issues

                          Thank you sir... I like that your able to hide default values such as the dates. Have another issue,that I've been trying to figure out last night. Using the "new" attached example, there's two colored buttons on the bottom left of form. Orange button has the error message inserted on around line 40 of code, the problem I'm having is, when user enters "Mike" in name the print preview report is open but the sort order that I want is wrong. It seems that by pressing orange button w/error code it is sorting by record number. Yellow button contains same error code (40) but I have commented the code out and it is sorting just fine. I have the sort order as: business name, city, date. Don't understand why the error message would have anything to do with sorting order. Also try either colored button and just press "OK" on the dialog screen which in turn displays all records.
                          Attached Files

                          Comment


                          • #14
                            Re: Print Preview Filter Issues

                            I can't get it to sort descending on the date field either.

                            I has some trouble getting the debugger to recognize date as a field name but even changing that didn't work.

                            Well, finally I see. Using the a5_get_records_in_query() resets the query.order variable to "" (blank).

                            Used this way the sort works. (You can remove the query.order = statement earlier in the script)

                            Code:
                            if a5_get_records_in_query("tblcustomer",query.filter)> 0 
                            	query.order = "business_name+city+invert(cdate(date))"
                            :Report.Preview("Customer",query.filter,query.order)
                            else
                            ui_msg_box("Error","No records were found with your search criteria...")
                            end if
                            Last edited by Stan Mathews; 10-25-2011, 04:30 PM.
                            There can be only one.

                            Comment


                            • #15
                              Re: Print Preview Filter Issues

                              I'll give it a try.... Thanks Stan

                              Comment

                              Working...
                              X