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

Date Dialog problems

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

    Date Dialog problems

    Struggling to teach myself Xbasic and here's where I'm stuck:

    Dr. Wayne's book, pages 142-144 -- I'm 99% sure I've done everything correctly, all I want is a date dialog to appear before a report.

    When I choose the report, the date dialog box appears fine, I enter two dates, click OK, the report begins to generate then there is an error message:

    Error occurred parsing filter expression
    Argument is incorrect data type
    (between((LTRIM(STR(DAY(DATE())))+"-"+CMONTH(DATE())+"-"+CYEAR(DATE())date...(don't know if there's more after that, message box ends).

    I used a filter expression in the Detail properties as shown on page 144 i.e.
    between(date,:date_dialog:starting_date.value,:date_dialog:ending_date.value)

    Then I showed "none" in the section of the Detail properties window "Additional Record Order and Filter Criteria".

    The order expression on the detail properties window is "pay_date".

    Is there anything that stands out to anyone as a problem? It seems like my filter expression is the culprit but I did copy that character for character...

    Thanks to any who have ideas...

    #2
    RE: Date Dialog problems

    Hi Jane,

    I do this diffently as I tried doing what you're attempting to do (instructions from the book) and I ended up with the same problem.

    Anyhow, I go to the Report's Detail Properties and click the Records tab. In the Filter Expression, I use the askd Vars for a date prompt, as follows:

    Between(SIGN_DATE,Var->Askd_Enter_Begin_Date,Var->Askd_Enter_End_Date)

    Click on the xy on the right side of the expression box and the click or drag the date field to the appropriate place; then with the cursor in the condition box, drag an askd var to the condition box, enter your message (Enter Begin Ddate) and then set the variable to date. Follow the example above and it will work just fine for you.

    This is a short, sweet way of doing it. The only draw back is that you don't have the flexibility of a fancy dialog box. All I care about is the user entering the right date.

    Hope this helps. Took it off the top of my head but it ought to be close.

    kenn
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

    Comment


      #3
      RE: Date Dialog problems

      I am constantly amazed, not only at the "tip of the iceberg" that I know and the "rest of the iceberg" that I don't, but how great this message board is.

      I had seen that Var box, , etc. but, gosh, didn't have a clue what it was for! This was a great (and easy) solution to what I wanted.

      Thanks Ken!

      Comment


        #4
        RE: Date Dialog problems

        I hate to disagree but in many ways it is a crude solution, one because as Ken said you (and your users) lose lots of flexibility and power, and two because it would appear you want to learn how to deal with date dialogs and reverting to ask variables does nothing in that regard.

        Now, as one who went through virtually all the examples in Peter's book, I can tell you more errors than he would like slipped into the final draft. Probably there is one in this case. I'll take a look later and get back to you here. But of course someone else will probably clear it all up before I ever get back here.

        Ray Lyons

        Comment


          #5
          RE: Date Dialog problems

          Ok, I'm back. But now that I have looked at pages 142-144 in Xbasic For Everyone I wonder if we have the same book.

          For example, I don't find anything like your:

          between(date,:date_dialog:starting_date.value,:date_dialog:ending_date.value)

          nor do I think Peter was suggesting on page 144 that you could use such an expression as a filter in the Detail properties of a report. The major problem with it is that presumably the date_dialog has already been closed, which means you can't use :date_dialog:starting_date.value any longer. Instead, before date_dialog is closed you want to assign that value (:date_dialog:starting_date.value) to a global varible, perhaps something like Start_Date (var->Start_Date). Because it is global that variable still exist with your value when the report is run. You would probably use var->Start_Date in your filter, along with one for the End_Date.

          Looking at your posting again I see that I may have misintrepreted: Is your filter part of a query, as appears at the top of page 144? If so the same thing applies: you can't use :date_dialog:starting_date.value because the date_dialog form is closed. As above, you need to assign that value to a global variable before closing the form and use the varibales in your query filter.

          In any case, don't give up too quickly on dialog forms to do this kind of thing. And I hope this helps a little.

          Ray Lyons


          Comment


            #6
            RE: Date Dialog problems

            Jane,

            What's the name of your ask date dialog form?

            The filter expression in your report layout:
            between(date,:date_dialog:starting_date.value,:date_dialog:ending_date.value)

            expects the dialog form to be named 'date_dialog', and

            expects the two date fields *on that form* to be named:
            starting_date
            ending_date and

            expects the field in your table that's being filtered to be called 'date'.

            If any of these four pieces is differently named then your filter expression fails, because Alpha Five can't find the form, or the fields, using the names specified in the expression.

            My guess is that your form and its field objects are named correctly.

            I'll bet the problem is with the data table field called 'date'.

            Jane, 'date' is problematic when used as a field name in your table. Why? It's identical to an important Alpha Five function called 'date()'. When Alpha Five encounters the word it expects you're using it to call the date() function, when you really want it to refer to your table's field. It's a good idea to avoid using function names for the names of fields in your tables, or objects on your forms. Rule number one, per Ira Perlow, never name a field in your table 'Date'.

            I'll bet all will go well if you restructure your table to give the 'date' field a new name, and then modify your script accordingly.

            Let us know how it turns out.

            -- tom

            -- tom

            Comment


              #7
              RE: Date Dialog problems

              Hi, Tom, long time no talk!

              It does concern me that I might have a different version of the book as Raymond mentioned, but here's my take:

              I used those pages and followed the instructions exactly. However, (and this is my complaint about the book) I don't think it was explained well enough for me to figure out:

              between(date,:(etc.)

              What does "date" stand for? I remember questioning that but off I went, following it exactly. Now I think in the book it stands for a field name but I thought it was just a part of the statement that I needed.

              I don't have any fields called "date", mine all have some description in them, like the field I want to use in the date dialog, "inv_purch_date".

              So before I go any further do you think that's the problem with my statement? Perhaps if I used "between(inv_purch_date,:date_dialog.."(etc) it would work?

              In the meantime Ken's solution is working fine and it might still be a good solution for the basic date requests. But Raymond's right, I need to learn this stuff!

              Thanks to all for the help -- will continue to forge ahead!

              Jane

              Comment


                #8
                RE: Date Dialog problems

                Jane,
                This is probably more information than you want, but here is a script that I use that actually works! (Sorry for the length, but I don't know how to attach a file)

                option nobreak
                dim FormPntr as p
                dim global StartDate as d 'global so I can print them on the report
                dim global EndDate as d
                dim LastButton as c
                dim global mn as c
                '**** Get the dates ****
                FormPntr=:form.load("DateRange","Dialog")
                FormPntr.show()
                FormPntr.activate()
                '**** Script pauses til user closes ****
                StartDate=FormPntr:SDate.value
                EndDate=FormPntr:EDate.value
                LastButton=FormPntr.last_pressed()
                FormPntr.close()
                if LastButton="CANCELBUTTON"
                goto Cancelled
                end if
                '**** Get the report type ****
                dim ReportName as c
                dim PrintType as c
                dim qfilter as c
                dim qorder as c
                ReportName=ui_get_list("REPORT NAME",1,"PERFORMANCE","SUMMARY","INCENTIVE","REFLOW DETAIL","REFLOW SUMMARY")
                ReportName=alltrim(ReportName)
                select
                case ReportName=""
                goto Cancelled
                case ReportName="PERFORMANCE"
                mn=ui_get_list("MACHINE NUMBER",1,"All","1","2","3","4","5","6")
                mn=alltrim(mn)
                if mn="All".or.mn=""
                qfilter="between(MeltDate,StartDate,EndDate)"
                else
                qfilter="(between(MeltDate,StartDate,EndDate)).and.(left(MachSide,1)=mn)"
                end if
                ReportName="Perf_Report"
                qorder="ProdCode+SerialNo"
                case ReportName="SUMMARY"
                Reportname="PerfSummary"
                qfilter="between(MeltDate,StartDate,EndDate)"
                qorder="ProdCode+SerialNo"
                case ReportName="INCENTIVE"
                ReportName="Incentive"
                qfilter="between(MeltDate,StartDate,EndDate)"
                qorder="left(machside,1)+serialno"
                case ReportName="REFLOW DETAIL"
                ReportName="ReflowResults"
                qfilter="between(DateEntry,StartDate,EndDate)"
                qorder="cdate(DateEntry)+ProdCode+SerialNo"
                case ReportName="REFLOW SUMMARY"
                ReportName="ReflowSummary"
                qfilter="between(DateEntry,StartDate,EndDate)"
                qorder="cdate(DateEntry)+ProdCode+SerialNo"
                end select
                '**** Print or view the report ****
                PrintType=ui_get_list("SEND TO",1,"PRINTER","SCREEN")
                if PrintType=""
                goto Cancelled
                elseif PrintType="PRINTER" then
                :report.print(ReportName,qfilter,qorder)
                else
                :report.preview(ReportName,qfilter,qorder)
                end if
                ui_beep(48)
                ui_msg_box("PRINT COMPLETE","The report has finished printing")
                END

                cancelled:
                ui_msg_box("CANCELLED","Report Printing was cancelled")
                end
                Pat Bremkamp
                MindKicks Consulting

                Comment


                  #9
                  RE: Date Dialog problems

                  Yes, you're correct. Check the syntax of the between() function in the xbasic reference manual. You'll see that the first argument in the parentheses is the name of the field... it must match the name of the field you are filtering on.

                  The scripts in Dr. Wayne's book are examples. Each and every one must be adapted to fit your particular database and should never be taken 'as is'. If you encounter a statement in a script that doesn't make sense to you, break it down and research it. It's like learning a foreign language. When you hit new words dig out the books.

                  -- tom

                  Comment

                  Working...
                  X