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

Report List in Xdialog

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

    Report List in Xdialog

    Here is a small script to see a list of reports in a Xdialog box. The selected report can be Previewed then printed if required. This script can be used in any aplication as it is not tied to a table or form.

    Keith Hubert
    Guild Member
    London.

    'Date Created: 27-Dec-2003 09:24:47 PM
    'Last Updated: 28-Dec-2003 03:23:12 PM
    'Created By : Keith Hubert
    'Updated By : Cal Locklin
    DIM SHARED a_reports[100] as C
    DIM SHARED varC_result as C

    report_list = a5.Report_Enum(2)
    a_reports.initialize(report_list)
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Print Report",{sp=2}
    {endregion};
    %dlg%, "" then
    report.preview(reportlist)
    end if
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    #2
    RE: Report List in Xdialog

    Hello Keith,

    Thanks for the code, I found it very useful.

    Thanks,

    Comment


      #3
      RE: Report List in Xdialog

      Hi Keith

      That's great piece of code!
      So small and so neat & useful.

      Thanks a lot.
      Robin

      Comment


        #4
        RE: Report List in Xdialog

        Keith,

        Thanks for posting the code! I added a few things:

        1. Added a sort function so that the reports sort in alphabetical order. [ a_reports.sort() ]

        2. I added a variable that I use in my applications which displays the Software name (v_Softwarename). I placed this variable in the pop-up box heading. If you do not have this global variable in your application, the heading will just display "List of Reports in the Program" rather than "List of Reports in the ABC Billing Program"

        3. Put some basic instructions on the pop-up form "Click on a Report, then Click OK to Preview" - My users need all the help they can get!


        'Date Created: 27-Dec-2003 09:24:47 PM
        'Last Updated: 25-Jan-2004 05:05:09 PM
        'Created By : Keith Hubert
        'Updated By :
        DIM SHARED a_reports[100] as C
        DIM SHARED varC_result as C
        DIM GLOBAL v_softwarename as c 'Added - see below

        report_list = a5.Report_Enum(2)
        a_reports.initialize(report_list)
        '==========================================================
        '1. Added a sorting function so that the reports sort in alphabetical order
        a_reports.sort() 'added this function to sort the reports in alphabetical order.
        '==========================================================
        ok_button_label = "&OK"
        cancel_button_label = "&Cancel"
        '==========================================================
        '1. Changed the Dialog box heading text to display the name of the program (found in the variable v_softwarename)
        '2. Added a check to see if the variable 'v_softwarename' has a value, if not, don't attempt to use it.
        '3. Increased the width so that the pop-up box would be a little wider from .4 to .8
        '4 Changed the Frame 1 Text to provide some instructions for the user 'Click on a Report, then Click OK to Preview'
        varC_result = ui_dlg_box("List of Reports in the "+if(alltrim(var->v_Softwarename)v_Softwarename))+" Program",{sp=2}
        {endregion};
        %dlg%, "" then
        report.preview(reportlist)
        end if


        Thanks again for posting some very usable code.

        Ron Wills
        Small Business Technology, Inc.
        [email protected]

        Comment


          #5
          RE: Report List in Xdialog

          Ron,
          Just used your script...
          GREAT
          Al Lipsky

          Comment


            #6
            Re: Report List in Xdialog

            I was happy to find this last night. Something I was looking for. But when I tried each of these dialogs I received errors.

            I first tried the dialog by Keith and received an error "Missing right parenthesis" on Line 12. As I examined the code again, I could see that although there was a parenthesis right after ui_dlg_box, there was not a closing one. So I added one at the very end and still got the same error. Added a parenthesis in other places and got different errors. Somehow, something's not being closed.

            I then tried the dialog by Ron. When I try to save that, I get a "Bad Expression Character" error on line 43. Tried to change a few things, but to no avail.

            Perhaps in the last 6-7 years the coding requirements have changed.

            Any thoughts?

            Les

            Comment


              #7
              Re: Report List in Xdialog

              The code has become corrupted somehow.

              Keith's

              Code:
              DIM SHARED a_reports[100] as C 
              DIM SHARED varC_result as C 
              
              report_list = a5.Report_Enum(2) 
              a_reports.initialize(report_list) 
              ok_button_label = "&OK" 
              cancel_button_label = "&Cancel" 
              varC_result = ui_dlg_box("Print Report",<<%dlg% 
              {frame=1,2:Select a Report to Print} 
              {sp=.5} 
              {lf=1} 
              {region} 
              [.40,15reportlist^#a_reports!select_report]; 
              {endregion}; 
              {region} 
              {lf}{justify=center} 
              <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL> 
              {endregion}; 
              %dlg%,<<%code% 
              if a_dlg_button="select_report" then 
              a_dlg_button="" 
              end if 
              %code%) 
              
              if varc_result = "OK" .and. reportlist <> "" then 
              report.preview(reportlist) 
              end if
              There can be only one.

              Comment


                #8
                Re: Report List in Xdialog

                Thanks Stan. Works perfectly.

                Les

                Comment


                  #9
                  Re: Report List in Xdialog

                  Great bit of 'simple' coding. I just grabbed this and modified to give user a list of letters to select from to edit...

                  'Date Created: 14-Sep-2011 07:41:19 AM
                  'Last Updated: 14-Sep-2011 07:41:19 AM
                  'Created By : Jon
                  'Updated By : Jon
                  DIM SHARED a_letters[100] as C
                  DIM SHARED varC_result as C

                  letter_list = a5.letter_Enum(2)
                  a_letters.initialize(letter_list)
                  ok_button_label = "&OK"
                  cancel_button_label = "&Cancel"
                  varC_result = ui_dlg_box("Edit letter",<<%dlg%
                  {frame=1,2:Select a letter to Edit}
                  {sp=.5}
                  {lf=1}
                  {region}
                  [.40,15letterlist^#a_letters!select_letter];
                  {endregion};
                  {region}
                  {lf}{justify=center}
                  <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
                  {endregion};
                  %dlg%,<<%code%
                  if a_dlg_button="select_letter" then
                  a_dlg_button=""
                  end if
                  %code%)

                  if varc_result = "OK" .and. letterlist <> "" then
                  a5_layout_design(letterlist,"letter")
                  'letter.preview(letterlist)
                  end if

                  Thanks,

                  Jon

                  Comment


                    #10
                    Re: Report List in Xdialog

                    FWIW:

                    - one of my pet peeves is the use of arrays when they aren't necessary. Alpha does this a lot in their examples but I think it just makes things more complicated - it adds extra lines that complicate the code and it also leaves the issue of setting the array size. In this particular case, this routine wouldn't work in a few of my apps because they have over 100 reports. Of course, I could change the number but that makes it less generic. Or, the script itself could determine the number of lines needed after getting the list and then set the array but why even bother doing all that when the array is totally unnecessary?

                    - another pet peeve is the use of regions that are completely unnecessary.

                    Here's the same thing as above but without the array (sorting is still easy) and with a few other changes. This was done not to correct anyone (I started from Stan's version only because it was convenient to do so) but hopefully to help people learning xdialog by providing some new ideas and explaining the logic of why I do certain things.

                    Add'l changes:

                    - The use of Shared variables probably isn't needed and they shouldn't be set as Shared unless necessary. Shared variable are used a lot in Action Scripting because they are often necessary due to the fact that multiple actions are combined. If writing 'normal' xbasic routines they shouldn't be used unless needed. Using Shared variables when not necessary opens up the possibility for accidentally changing a variable that wasn't meant to be changed. If you DON'T use a Shared variable when one IS needed, the code probably won't work and you will find out very quickly. If you DO use a Shared variable when it is NOT needed, the code may work just fine but something else outside of the code you are working on may get messed up and it's likely to take awhile to figure out why since you probably weren't thinking about that other script that used the same variable name.

                    - The regions could be removed completely but I left one in only because it makes the frame command easier. The frame now goes around 1 "line/vertical item" (the region) and the number of lines inside the region can be changed without needing to change the "1,1" in the frame command. This is a somewhat unusual use of regions but it definitely makes things easier. Just be aware that every region you add to an xdialog adds a little bit of extra space after the region. (Another "feature" of A5.) The more regions you use, the larger the extra space at the bottom and the only solution is to eliminated the regions.

                    - I changed some variable names but that's just personal preference - I think they are more descriptive of what the variable actually is. For example, using "reportlist" to return the name of one report doesn't seem like 'good form' to me.

                    - Simplified the naming of the buttons. (Alpha's default method is OK for Action Scripting but it isn't necessary and is overly complex in 99% of the cases.)

                    - Changed the %Code% section so the user can't accidentally click the OK button and exit without selecting a report. This is much more user friendly than making the user start all over again. It also tells the users what was wrong rather than forcing them to figure it out on their own when nothing happens after clicking the OK button.

                    - Removed the event action in the report list control. There may have been a need for it that was removed before posting the original routine; for example, I would have added the ability for the user to double click the report name but I didn't add that here. There are enough things added/changed already.

                    - Note also a couple things I did to the frame. I made it bold and added an extra space before and after the text. It's a minor thing but I've never liked how close the frame line is to the text so I add the extra spaces to fix that. Obviously you don't need to do that unless you want to but it took me awhile before I tried it and discovered that it would work.

                    - At the last minute I decided to throw in the ability to resize the dialog since some people may find that useful. It originally took me a little bit to figure out the correct syntax to make this work but I use it a lot now. Add the {stretch} command before the display box and add the{stickto} command before the buttons. (Note - it gets much more complicated when there are multiple objects getting stretched!) If the buttons are centered, use {stickto=bottom,center} and if they are left justified, use {stickto=bottom,left}. The {remember} commands can also be useful for opening the dialog up in the same place and size in the future but I'll leave it up to you to check the Help file for more info on that.

                    Code:
                    DIM report_list as C 
                    DIM dlg_result as C 
                    
                    report_list = sortsubstr( a5.Report_Enum(2), crlf() )
                    dlg_result = ui_dlg_box("Print Report",<<%dlg% 
                    {font=Arial,9,b}{frame=1,1: Select a Report to Print }{font=Arial,9,n}
                    {region}
                    {sp=.5} 
                    {lf=1}
                    {stretch=height,width}[.40,15report_chc^#report_list]; 
                    {stickto=bottom,center}{lf}{justify=center} 
                    <*15OK> <15Cancel>
                    {endregion}
                    %dlg%,<<%code% 
                    IF a_dlg_button="OK"
                    	IF report_chc = ""
                    		ui_msg_box("SELECTION REQUIRED", "Please select a report or press 'Cancel' to quit.", ui_attention_symbol )
                    		a_dlg_button=""
                    	END IF
                    END IF
                    %code%) 
                    
                    IF dlg_result = "OK"
                    	report.preview( report_chc ) 
                    END IF

                    Comment

                    Working...
                    X