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

Using run time variables on actual report

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

  • Using run time variables on actual report

    I am trying to develop an application for a friend who needs to print a report monthly. I generate the report using a start date and end date which are provided by asking for them at run time to limit what goes into the report each month. Is there a way to actually use the two dates provided at run time in the report itself? I can actually use the system date as the "end date" of each report but the start date only exists at run time when it is asked for.
    Thanks for any help.

  • #2
    Re: Using run time variables on actual report

    You don't say if this is desktop or web. I'll assume that it's a desktop question.

    In the code where you get the start and end dates, define the variables as global as in "dim global sdate as d" if they are date variables. Then, go to your report, report properties, variables, and define the same variables as global within the report.

    When you run the script that prints the report, the date values will now be picked up by the report.
    Finian

    Comment


    • #3
      Re: Using run time variables on actual report

      Thanks Finian for such a prompt reply. It is a desktop application. I used action scripting to "Print an existing report" and as part of definition of this action I had it ask for a startdate and enddate at run time. This allowed me to filter the data for just the month that I am interested in. Not quite sure where to define the global variables although I do understand how it would then work. Again, thanks for your reply.

      Comment


      • #4
        Re: Using run time variables on actual report

        Hi David,
        Without knowing the specifics of the project, but based on this being a "monthly" report, I can't help
        but think the dates you want are likely to be from the previous month.

        I think you can set the report to print using the following filter
        Code:
        between(<reportdate>,date_firstdayofpreviousmonth(),date_lastdayofpreviousmonth())
        where <reportdate> is the field to be filtered. This would mean no more "need" for user intervention
        or possibility of user error as well as the potential to run the report automatically.

        Comment


        • #5
          Re: Using run time variables on actual report

          Gregg,
          It is not the start and end dates choice that I was interested in, as the action script asks the user (secretary) to give them using its pop up calendar. But as the start date and the end dates are somewhat non regular, meaning monthly, bi-monthly, 2 months etc what I wanted to do was gather whatever is placed into the scripts start and end date and actually print those two dates on the report itself. As the report is really a bill, it would allow the receivers of the bill to see what time frame they are being billed for. I like your code and have never used it before but will definately keep it in mind in the future. Thank you for your reply.

          Comment


          • #6
            Re: Using run time variables on actual report

            David:

            You can convert the Action Script to xbasic (do a "Save As" first to preserve the existing sccript) and then edit the xbasic. It's a little daunting at first because the script may come out with 40 or 50 lines (that's just a guess) which are Alpha's way of dealing with every conceivable circumstance in which the script might be run. In truth though, the script can be reduced greatly down to the definition of the variables and the dialog box for their entry and the "Report.print" line. You could try simply inserting the word "global" into each "Dim global start_date " line.

            However, the dates won't appear in the report until you edit the report and define the date variables as global in the report itself.
            Finian

            Comment


            • #7
              Re: Using run time variables on actual report

              Finian, that sounds great. I will try that. Thanks again.

              Comment


              • #8
                Re: Using run time variables on actual report

                David and Finian,

                As long as you define the global variable before running the report, you should not need to define
                the variable in the report.
                Capture.PNG

                Comment


                • #9
                  Re: Using run time variables on actual report

                  Old habits die hard! There was a time (however long ago that might have been) when I'm pretty sure it was essential to include the definition in both places. Of course, global should BE global, so that's one old habit to kill off.
                  Finian

                  Comment


                  • #10
                    Re: Using run time variables on actual report

                    I have turned the action script into xbasic and see only this code :

                    'Run script locally (using local variables): Monthly Patient Report
                    script_play("Monthly Patient Report")

                    I also defined two new variables on the report StartDate and EndDate and as part of the definition they demand I include actual date so I put in 01/01/20. When I placed these variables in the report they show up (as expected) as 01/01/20) and not the dates the are asked for in the above script. Those dates are asked for at runtime and are not available or evident in the xbasic. How do I get the created variables in the report to use the date asked for at runtime?
                    david

                    Comment


                    • #11
                      Re: Using run time variables on actual report

                      I don't know if this will help or confuse things but download the attached file and put it in a known location. Open the Control Panel, Code Tab, right click in white space, choose import and select the text file. The file has two functions, Get2Dates and Print_Invoice1. The Get2Dates function is called from the Print_Invoice 1 function.

                      You can print the report by putting the line
                      PrintInvoice_1()
                      into a script or as the event on a button and executing it.

                      The PrintInvoice_1 function is a cut down version of something I use regularly. I use SDate and Edate for the global date variables so the report would need to conform to those names. The PrintInvoice_1 has some stuff in there to run a query before attempting to preview or print the report. You will need to change table and field references. Hopefully I've indicated all the places where you need to do that.
                      Attached Files
                      Finian

                      Comment


                      • #12
                        Re: Using run time variables on actual report

                        You can also do this in your script that calls the report

                        with global_variables()
                        startdate = ctod(ui_get_date_calendar("Start Date",dtoc(date()))
                        enddate = ctod(ui_get_date_calendar("End Date",dtoc(startdate))
                        end with
                        Last edited by MoGrace; 07-23-2019, 02:43 PM. Reason: fix syntax errors
                        Robin

                        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                        Comment


                        • #13
                          Re: Using run time variables on actual report

                          Finian I downloaded and went over your code. I thank you for your reply but it is so far above what I can do myself that I hesitate to try to amend it in any way. Thank you very much for your earnest reply. I will continue looking.
                          david

                          Comment


                          • #14
                            Re: Using run time variables on actual report

                            Robin After fixing a missing right parenthesis and replacing the single quote around "end date" with a double one, this worked for me. Thank you for your effort and help.
                            david

                            Comment


                            • #15
                              Re: Using run time variables on actual report

                              So much for my syntax checking! Glad you got it to work.

                              Fixed above post...
                              Robin

                              Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                              Comment

                              Working...
                              X