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

Xdialog Cancel Button

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

    Xdialog Cancel Button

    Hello all, I'm new at programming with alpha 5 and need some help with the following: (1) I have created a dialog box that a user inputs the date range of the report they would like to print, if the user enters begin date and end date presses "OK" works as expected, but if the "Cancel" button is pressed, the report is displayed just as if the "OK" button was pressed, I would like to see the dialog box close at this point. (2) How do you display the filter expression of the report on the report itself. If the user selects a date range of 01/01/09 to 01/15/09, I would like to display this on the report.

    I have included a very basic example. If someone could please help, it would be appreciated.... Thank You.. Kelly

    #2
    Re: Xdialog Cancel Button

    Kelly,
    The code generated by action scripting has the button pushed in the xdialog collected in the variable VarC_results. What you need to do is make the Preview a Layout action conditional upon the value of the VarC_results variable (see picture).
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    Comment


      #3
      Re: Xdialog Cancel Button

      Mike, thank you for your "working solution". A couple questions if you don't mind... Using my example database as reference, If a user inputted a date range that had no records, what code would be needed to show a message box saying " Zero records found". Right know a blank white page will displays. Second question: I would like to be able to show on the report how the report is filtered ("Report Date Range ?????"). Right know on my example, I've placed the Current_Filter from the System DragDrop List, but not to happy in the results. Once again thank you.... Kelly

      Comment


        #4
        Re: Xdialog Cancel Button

        What you would need to do is to do a query of the table based on the date range. If no records are in the query, then display a message box stating that there are no records, otherwise run the report.

        Tom

        Comment


          #5
          Re: Xdialog Cancel Button

          Tom, thanks for your reply. If you look at my example database in my original thread, I'm using a xdialog box with a query based on date ranges (beginning and ending), I know that I need to place a message box stating something like "ZERO RECORDS FOUND", but I'm not sure where and honestly how to place the code to do this. If you don't mind looking at my example database and showing me and/or placing the code, it would be appreciated.. Thank you in advance.... Kelly

          Comment


            #6
            Re: Xdialog Cancel Button

            Kelly,
            Add two actions to the script, change the scope of the dates to global, and add the date global variables to your report.

            The action scripting now has two actions. What you will have to do is insert two actions: 1) a message box with the message that there are no records found, and 2) End Script action. Both of these are going to be set conditional to the value of the expression using a5_get_records_in_query()=0 . Learn about this function, it is a mainstream function for this exact purpose. To set the date variables to global, highlight the first action script and press the toolbar icon to the right of the eyeglasses (spectacles) to convert the script to Xbasic. From there, edit the script by changing the scope of the date variables by changing their dim from shared to global. With the dates being set to global, you can pass these values to the report. Simply add these variable fields onto the report. Theses changes are in the attached example. I also included a duplicate of your script with the added 2 action scripts above combined into one in-line xbasic script.

            Good luck.
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #7
              Re: Xdialog Cancel Button

              Not for nothing, but I am WAAAYYY more comfortable with x_basic than action scripting, so I converted the action script into code, then cleaned out all of the extraneous stuff. The code below checks for records within the date range and if there are no records, displays a message box stating that, else it previews the report.

              Hope it helps...

              (my code is in red, everything else was created by the action script, I just cleaned it out a bit)

              Code:
              'Create an XDialog dialog box to prompt for parameters.
              DIM SHARED DateBegin as D
              DIM SHARED DateEnd as D
              DIM SHARED varC_result as C
              heading_string = "Enter Date Range of Report"
              ok_button_label = "&OK"
              cancel_button_label = "&Cancel"
              varC_result = ui_dlg_box("Customer Contact Report",<<%dlg%
              {region}
              {text=30,1:heading_string};
              {endregion};
              {region}
              Beginning Date:|	[%DATE;P=popup.calendar(dtoc(DateBegin));I=popup.calendar%.15DateBegin!DateBegin_*];
              Ending Date:|	[%DATE;P=popup.calendar(dtoc(DateEnd));I=popup.calendar%.15DateEnd!DateEnd_*];
              {endregion};
              {line=1,0};
              {region}
              <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
              {endregion};
              %dlg%,<<%code%
              if left(a_dlg_button,10) = "DateBegin_" then 
              	if a_dlg_button = "DateBegin_killfocus" then 
              		DateBegin = ctod(dtoc(DateBegin))
              	end if 
              	a_dlg_button = ""
              end if 
              
              if left(a_dlg_button,8) = "DateEnd_" then 
              	if a_dlg_button = "DateEnd_killfocus" then 
              		DateEnd = ctod(dtoc(DateEnd))
              	end if 
              	a_dlg_button = ""
              end if
              %code%)
              
              dim  cnt as N
              
              'debug(1)
              [COLOR="DarkRed"]cnt = a5_get_records_in_query("customer",between_date("Contact_date",var->datebegin,var->dateend))
              'Conditional code follows. Executes only if the condition expression is True.
              IF cnt=0
              	ui_msg_box("Customer Report","No Customers match dates in the range of "+dtoc(var->datebegin)+" to "+dtoc(var->dateend))
              
              	END    'DO NOT PRINT THE REPORT
              
                ELSE[/COLOR]	'Preview a report, label, letter, form or browse layout. You can specify which records to preview.
              	query.filter = "between(Contact_date,Var->DateBegin,Var->DateEnd)"
              	query.order = "recno()"
              	'replace variables in the filter with their actual values	
              	query.filter = convert_expression(query.filter,"V")
              	:Report.Preview("Customer Report",query.filter,query.order)
              END IF
              END
              Tom
              Last edited by Tom Henkel; 03-31-2009, 11:15 AM. Reason: took out the debug

              Comment


                #8
                Re: Xdialog Cancel Button

                Sure Tom,
                Take the easy way out...;)
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment


                  #9
                  Re: Xdialog Cancel Button

                  Mike,

                  What can I say, I just find that action scripting creates so much excess code, it sometimes trips over itself, especially in conditional expressions. When testing, I set the variable "cnt" and saw the number. Then, the action script did an "a5_eval_expression", and didn't see it. Taking all that out, and just doing a simple "IF", things work fine.

                  Tom

                  Comment


                    #10
                    Re: Xdialog Cancel Button

                    Tom,
                    I was kidding. I am with you on this, believe me! I have to completely regroup to remember how to conditionalize action scripts.
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: Xdialog Cancel Button

                      Mike,

                      Honest, I took no offense. It would take an awful lot to offend me...;)

                      Tom

                      Comment


                        #12
                        Re: Xdialog Cancel Button

                        Hi Tom,

                        Originally posted by Tom Henkel View Post
                        Honest, I took no offense. It would take an awful lot to offend me...;)
                        OK...There was a Rabbi, Priest and a Minister walked into a bar...:)

                        I've spoken against Action Script as the best course before (with somewhat a storm of reactions), but if it's a person's only course, it's better than nothing for those unable to grasp programming at a code level.

                        I can tell you there are some techniques buried in Action Scripting that are used no where else, so they are worth looking at, and using them to generate code (especially XDialog, and particularly Xdialog ListView objects - as an aside, I have probably figured out as much as is possible about Alpha's Listview. I'm not sure I would have taken the same approach for the events, and my code tends to linearize the Listview code to allow more flexibility for me.)

                        After AS generates the code, as you have done, take out the fluff, redundant sequences and you almost have "normal" code. The difference is faster, more reliable code over the long haul.
                        Regards,

                        Ira J. Perlow
                        Computer Systems Design


                        CSDA A5 Products
                        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                        CSDA Barcode Functions

                        CSDA Code Utility
                        CSDA Screen Capture


                        Comment


                          #13
                          Re: Xdialog Cancel Button

                          Mike,
                          I have to completely regroup to remember how to conditionalize action scripts.
                          I consider myself somewhat fortunate in this case as I never even attempted conditionals with Action Scripting! Xbasic seemed to be much more straight-forward to learn and use regarding these (and still think so).
                          Mike
                          __________________________________________
                          It is only when we forget all our learning that we begin to know.
                          It's not what you look at that matters, it's what you see.
                          Henry David Thoreau
                          __________________________________________



                          Comment


                            #14
                            Re: Xdialog Cancel Button

                            Just wondering, we've gone off on our own tangent. Is Kelly still with us? and, if so, did anything we have done here helped?

                            Tom

                            Comment


                              #15
                              Re: Xdialog Cancel Button

                              Tom, thank you for your concerns. Both you and Mike's solutions worked. I did have a couple questions about yours. No matter what I did with your solution, I couldn't get it to print the date range on the report. I change the variables Datebegin & DateEnd to Global a still nothing. Also, on your solution when a user presses the cancel button, it still opens the report. I can see how Mike did it using Action scripting, but after reading several replies to this thread, most people are steering away from Action scripting.

                              Thanks again for your help... Kelly

                              Comment

                              Working...
                              X