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

From and To report filter problem

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

    From and To report filter problem

    I read the existing post but cannot use the recommended between argument to build a successful filter. I want to filter the report for dates between fromdate and todate and let the user choose which report they wish to view. The radiobutton of report selection works fine if tested with filter = ""
    I would appreciate any help on this. Submitting the code below opens Adobe but it displays a single page in acrobat stating "Report does not contain any records".

    Code:
    IF eval_valid("fromdate") = .f. .or. eval_valid("todate") = .f. Then
    goto skipreport
    end if 
    dim filter as c 
    dim order as c 
    Filter = "between(dtoc(transdate)," + s_quote(fromdate) + "," + s_quote(todate) + ")"
    Order = ""
    
    Dim filename as c 
    select
        case radiobutton3="1"
        	 filename = session.session_folder + chr(92) + "tempreport.pdf"
       		 filename = report.saveas("MonthlyTellerActivity@<ADB_Path>\tellertotals.dbf","pdf",filter,order,filename,.f.)
    		 if file.exists(filename) 
    			currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + rand_string(5)
    		end if
    	case radiobutton3="2"
    		 filename = session.session_folder + chr(92) + "tempreport.pdf"
    		 filename = report.saveas("MonthlyTellerReport@<ADB_Path>\tellertotals.dbf","pdf",filter,order,filename,.f.)
    		 if file.exists(filename) 
    		 	currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + rand_string(5)
    		end if
    
    end select
    skipreport:

    #2
    Can anyone assist with this please?

    Comment


      #3
      This explains why your filter is broken:

      dim transdate as d; transdate = {01/15/2006} 'US format
      dim fromdate as d; fromdate = {01/01/2006}
      dim todate as d; todate = {01/31/2006}

      ?dtoc(transdate)
      = "01/15/2006"

      ?s_quote(fromdate)
      = "{01/01/2006}"
      Notice that s_quote() returns a date type value, while dtoc() returns a character type value. You cannot compare one to the other.

      ------------------------------------------------------------------------

      Using the Invoice report in AlphaSports, the following seems to work ok,
      and could be adapted to your situation:

      :report.preview("Invoice","between(date,"+s_quote(fromdate)+","+s_quote(todate)+")")
      where date is a date type field;
      fromdate is a date type variable; and
      todate is a date type variable.
      Hope this helps.

      -- tom
      Last edited by Tom Cone Jr; 02-27-2006, 10:38 PM.

      Comment


        #4
        George, see this thread: http://msgboard.alphasoftware.com/al...ad.php?t=59900

        Comment


          #5
          Tom, thank you for the reply. I am still getting an error on this of:
          Errors in: event.AfterValidate code:
          Variable is of different type

          I have altered the code to that shown below. Also, how can I do your '?dtoc(transdate)' on the web projects control panel to see what certain variables are going to return from a a5w page? Like an interactive screen on the desktop side.

          Code:
          IF eval_valid("fromdate") = .f. .or. eval_valid("todate") = .f. Then
          goto skipreport
          end if 
          dim filter as c 
          dim order as c 
          dim transdate as d
          dim fromdate as d
          dim todate as d
          Filter = "between(transdate," + s_quote(fromdate) + "," + s_quote(todate) + ")"
          Order = ""
          
          Dim filename as c 
          select
              case radiobutton3="1"
              	 filename = session.session_folder + chr(92) + "tempreport.pdf"
             		 filename = report.saveas("MonthlyTellerActivity@<ADB_Path>\tellertotals.dbf","pdf",filter,order,filename,.f.)
          		 if file.exists(filename) 
          			currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + rand_string(5)
          		end if  . . .snipped. . .
          Last edited by George Corder; 02-28-2006, 09:42 AM.

          Comment


            #6
            George,

            I don't see where fromdate and todate receive their values.
            I don't see the error message you're getting.
            When you dim fromdate and todate like this you're creating local variables. Is this what you want, or are you trying to use values assigned in earlier sequences?

            I have little experience with the web app server. Can't tell you how to trouble shoot this in that context.

            Does your script work in the desktop?

            -- tom

            Comment


              #7
              On the a5w page I have created a dialog component that ask's the user to input the fromdate and todate along with which of 2 reports they want to view. This is supposed to hold the date choices in the fromdate and todate variables.

              I am going to attend the PACE 2 hr tech support webinar tomorrow at 2:00p and will ask for help on this.

              Last edited by George Corder; 02-28-2006, 10:41 AM.

              Comment


                #8
                Like in the Alha Five desktop, reports run in their own session and do not have access to local variables. You must dim and use a global variable in order for your report to see it.

                Originally posted by George Corder
                On the a5w page I have created a dialog component that ask's the user to input the fromdate and todate along with which of 2 reports they want to view. This is supposed to hold the date choices in the fromdate and todate variables.

                I am going to attend the PACE 2 hr tech support webinar tomorrow and will ask for help on this.

                Lenny Forziati
                Vice President, Internet Products and Technical Services
                Alpha Software Corporation

                Comment


                  #9
                  George,

                  I think the values in your variables are not carrying forward into the script and the filter expression. I wish I know more about the Web App serve so I could tell you how to determine what the variable values are when the script is running. There's an entire chapter in the Web Publishing reference on using variables in a5w pages. My guess is that you have to pass on the values inputted by the user to the next page somehow. Otherwise the variables in your script are empty when the filter tries to evaluate them.

                  Perhaps more knowledgable folks will lend a hand here. I'll be watching, cause your script is failing even though the filter expression is (finally) ok.

                  -- tom

                  Comment


                    #10
                    George,

                    Thanks for the call, but I think I will put up a solution here rather than off-line.

                    This filter works (substituting your field names for mine, and assuming your table field is an Date type):

                    Code:
                    Filter = "received_date > {"+date1+"} .and. received_date < {"+date2+"}"
                    Everything else in your code and dialog is fine. I could not get the between() to work and admit that I don't work with dates enough to be quick on that.
                    Steve Wood
                    See my profile on IADN

                    Comment


                      #11
                      Thanks Steve. I have tried to add in the variables as mentioned by Tom. I cannot get the Filter to work still. I have tried you code above and narrowed it down to just trying to get the "Fromdate" to work as shown below. Do you have any other thoughts?

                      Code:
                      IF eval_valid("fromdate") = .f. .or. eval_valid("todate") = .f. Then
                      goto skipreport
                      end if 
                      dim filter as c 
                      dim order as c
                      
                      dim Global date1 as d
                      dim Global date2 as d
                      date1 = "fromdate"
                      date2 = "todate"
                      
                      Filter = "transdate >=" + "+s_quote(date1)+"
                      Order = "Branchid"
                      
                      Dim filename as c 
                      select
                          case radiobutton3="1"
                          	 filename = session.session_folder + chr(92) + "tempreport.pdf"
                         		 filename = report.saveas("MonthlyTellerActivity@<ADB_Path>\tellertotals.dbf","pdf",filter,order,filename,.f.)
                      		 if file.exists(filename) 
                      			currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + rand_string(5)
                      		end if
                      	case radiobutton3="2"
                      		 filename = session.session_folder + chr(92) + "tempreport.pdf"
                      		 filename = report.saveas("MonthlyTellerReport@<ADB_Path>\tellertotals.dbf","pdf",filter,order,filename,.f.)
                      		 if file.exists(filename) 
                      		 	currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + rand_string(5)
                      		end if
                      
                      end select
                      skipreport:

                      Comment


                        #12
                        Did you try the filter I suggested? Using your variables, it would be:

                        Filter = "transdate >= {"+fromdate+"} .and. transdate <= {"+todate+"}"

                        exactly as shown, including all the curly brackets, etc.

                        Your Filter = "transdate >=" + "+s_quote(date1)+" is not properly formed at all.

                        You do not need to dim any variables as global, even though that was suggested below.
                        Steve Wood
                        See my profile on IADN

                        Comment


                          #13
                          Fantastic Steve. I have inserted the final working code below.

                          I would like to add the target="_blank" tag or equivelant code to instruct the pdf to open in a new window or tab of the browser, but I don't know where I should put this.

                          I appreciate your help.

                          Code:
                          IF eval_valid("fromdate") = .f. .or. eval_valid("todate") = .f. Then
                          goto skipreport
                          end if 
                          dim filter as c 
                          dim order as c
                          
                          Filter = "transdate >= {"+fromdate+"} .and. transdate <= {"+todate+"}"
                          Order = "Branchid"
                          
                          Dim filename as c 
                          select
                              case radiobutton3="1"
                              	 filename = session.session_folder + chr(92) + "tempreport.pdf"
                             		 filename = report.saveas("MonthlyTellerActivity@<ADB_Path>\tellertotals.dbf","pdf",filter,order,filename,.f.)
                          		 if file.exists(filename) 
                          			currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + rand_string(5)
                          		end if
                          	case radiobutton3="2"
                          		 filename = session.session_folder + chr(92) + "tempreport.pdf"
                          		 filename = report.saveas("MonthlyTellerReport@<ADB_Path>\tellertotals.dbf","pdf",filter,order,filename,.f.)
                          		 if file.exists(filename) 
                          		 	currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + rand_string(5)
                          		end if
                          
                          end select
                          skipreport:

                          Comment


                            #14
                            I asked that question once and was told it is not possible to cause the PDF to open in a new window. _target was incompatible with redirect. _target is normally associated with <a href...>.

                            You might search for that thread to see if there was an alternate suggestion; javascript perhaps. I haven't resolved this - the problem is that users close the PDF and therefore unintentionally close the WAS application.
                            Steve Wood
                            See my profile on IADN

                            Comment

                            Working...
                            X