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

.AND.

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

    .AND.

    This is a filter on a grid entered in the filter box of the Query pane. The parts of this expression work by themselves. But when combined with .AND., it does not work.

    cyear(Year) This works in the expression builder but it but not in the grid filter.

    R1= .t. This works in the expression builder and in the grid filter.

    cyear(Year) .AND. R1= .t. This does not work in the expression builder

    I've tried (cyear(Year)) .AND. (R1= .t.) but this doesn't work either. What is needed to get this to work?

    The ultimate filter will be to filter for the current year and and if any of the logical fields are .t.. I'm thinking the filter would be something like:

    cyear(Year) .AND. R1= .t. .OR. R2= .t. R3= .t. .OR. R4= .t. .OR. R5= .t. .OR. R6= .t. .OR. R7= .t.

    Another way might be:

    cyear(Year) .AND. R1= .t. .OR. cyear(Year) .AND. R2= .t. .OR. cyear(Year) .AND. R3= .t. .OR. cyear(Year) .AND. R4= .t. .OR. cyear(Year) .AND. R5= .t. .OR. cyear(Year) .AND. R6= .t. .OR. cyear(Year) .AND. R7= .t.


    UPDATE:

    This works in the grids filter:
    R1=.t. .or. R2=.t. .or. R3=.t. .or. R4=.t. .or. R5=.t. .or. R6=.t. .or. R7=.t.

    This works in the grids filter
    Year(Date() )

    But, together, they do not work. Is this a valid filter or is there a bug?

    R1=.t. .or. R2=.t. .or. R3=.t. .or. R4=.t. .or. R5=.t. .or. R6=.t. .or. R7=.t. .AND. Year(Date() )
    Last edited by forskare; 04-05-2013, 06:21 PM.
    TYVM :) kenn

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

    #2
    Re: .AND.

    This is how I would do it.

    Code:
    year(myDateField) = year(date()) .AND. R1= .t. .OR. year(myDateField) = year(date()) .AND. R2= .t. .OR. etc, etc...
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

    Comment


      #3
      Re: .AND.

      Hi Frank,

      Yes, I tried that as well. I think the problem is mixing logical fields with a date field. I'm going to try it in a browse and see what gives.

      OK, I got this to work in a browse and the grid:

      (r1=.t.).or.(r2=.t.).or.(r3=.t.).or.(r4=.t.).or.(r5=.t.).or.(r6=.t.).or.(r7=.t.) .AND. Year = Year(Date())

      The problem was as I surmised, mixing logical with a date doesn't''t work, The date expression must also return logical.
      Last edited by forskare; 04-05-2013, 06:58 PM.
      TYVM :) kenn

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

      Comment


        #4
        Re: .AND.

        I think the grid query page only accepts SQL syntax so you would use "AND" instead of ".AND." and "OR" instead of ".OR.".

        Comment


          #5
          Re: .AND.

          I believe you are correct. It actually ignored the .AND. Year(Date()) and showed the records where the R fields were true even though the year field did not contain a value. I tried "AND" but neither the expression builder got the grid filter liked it.


          UPDATE:

          Well, using "AND" does not work and generates an error message. Using .AND. only half works because this part, (r1=.t.).or.(r2=.t.).or.(r3=.t.).or.(r4=.t.).or.(r5=.t.).or.(r6=.t.).or.(r7=.t.) works but this part is ignored .AND. year = year(Date()).

          I tired this by itself year = year(Date()) and it filters out all the records even though I have 2 that meet the criteria.
          Last edited by forskare; 04-05-2013, 08:46 PM.
          TYVM :) kenn

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

          Comment


            #6
            Re: .AND.

            I don't know if you are using SQL or DBF, but this works for SQL:

            myyear=year(currentdate()) and position("1",concatenate(r1,r2))>0

            Currentdate(), concatenate() and position() are portable sql functions. myyear is char. You should not use "year" as a field name.
            Last edited by Steve Wood; 04-05-2013, 08:42 PM.
            Steve Wood
            See my profile on IADN

            Comment


              #7
              Re: .AND.

              Hi Steve, I'm using dbf and I changed the name to curryear after my first post but still referred to it as year to avoid confusion on this thread.
              TYVM :) kenn

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

              Comment


                #8
                Re: .AND.

                Well you have to admit it was a good-looking SQL filter.

                Then this:

                myyear = cyear(date()) .and. (r1 .or. r2)

                You don't need the =.t.

                You do need dots as in .or., .and.
                Steve Wood
                See my profile on IADN

                Comment


                  #9
                  Re: .AND.

                  Yes, it is a nice sql filter. So is the one for the dbf,

                  This shows all the records as it should: (r1.or.r2.or.r3.or.r4.or.r5.or.r6.or.r7) because no value in the curryear field is part pf the filter

                  This shows NO records curryear = cyear(date()) but should show 3 because there are 3 records with a 2013 date in the curryear field.

                  This shows no records curryear = cyear(date()) .AND.(r1.or.r2.or.r3.or.r4.or.r5.or.r6.or.r7) and it only should show 3

                  Next, I tried this because there are 5 possibilities for each record which is what Frank suggested. The filter genie says it's goo but again, it's too good because all records are filter out. No records appear when 3 records should show up.

                  CURRYEAR=CYEAR(Date()).AND.R1.OR.CURRYEAR=CYEAR(Date()).AND.R2.OR.CURRYEAR=CYEAR(Date()).AND.R3.OR.CURRYEAR=CYEAR(Date()).AND.R4.OR.CURRYEAR=CYEAR(Date()).AND.R5.OR.CURRYEAR=CYEAR(Date()).AND.R6.OR.CURRYEAR=CYEAR(Date()).AND.R7

                  This is what the grid row looks like:

                  Curryear R1 R2 R3 R4 R5 R6 R7

                  Curryear is a date field and the R fields are checkboxes.


                  As you can see, I'm showing the corrected field name, curryear. If anyone would like the table to work with, please post or pm your email or web site and I'll send it to you. I will try to attach it here but I still am not able to attach files to the message board.

                  I tried to attach a zip file but it would not upload.
                  Attached Files
                  Last edited by forskare; 04-05-2013, 11:03 PM.
                  TYVM :) kenn

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

                  Comment


                    #10
                    Re: .AND.

                    There is no such thing as a "checkbox" field, but I assume you mean Logical.

                    If curryear is a date field then "curryear = cyear(date())" is never going to work because the result from cyear(date()) is just "2013" and you are asking is {5/4/2013} = "2013".

                    You'd want this:

                    cyear(Curryear) = cyear(date())...

                    Your long filter: CURRYEAR=CYEAR(Date()).AND.R1.OR.CURRYEAR=CYEAR(Date())...
                    Is the same as: Curryear = cyear(date()) .and. (r1 .or. r2....)
                    Last edited by Steve Wood; 04-06-2013, 12:28 AM.
                    Steve Wood
                    See my profile on IADN

                    Comment


                      #11
                      Re: .AND.

                      Originally posted by forskare View Post
                      This is a filter on a grid entered in the filter box of the Query pane. The parts of this expression work by themselves. But when combined with .AND., it does not work.

                      But, together, they do not work. Is this a valid filter or is there a bug?

                      R1=.t. .or. R2=.t. .or. R3=.t. .or. R4=.t. .or. R5=.t. .or. R6=.t. .or. R7=.t. .AND. Year(Date() )
                      The filter itself will not work, since in this filter above you are not comparing Year(Date() with anything...
                      If START contains 05/25/1995, then ? year(START) throws 1995 (look at function examples).

                      So, ".AND. Year(Date() " is actually: ".AND. 1995". Which does not filter anything since the field is missing where you compare against.
                      This part should be something like:

                      tbl.fieldname1 = Year(Date()) or var1 = Year(Date())

                      The longer the filter expression becomes, the more complex things get since the expression builder does not make relationships/dependencies within the filter very clear.

                      Comment


                        #12
                        Re: .AND.

                        Hi Ken

                        Have you set the grid property for each of the "r" fields to "Treat field as a logical field" ?

                        Have you tried this:

                        Code:
                        ((r1=.t.).or.(r2=.t.).or.(r3=.t.).or.(r4=.t.).or.(r5=.t.).or.(r6=.t.).or.(r7=.t.)) .AND. cyear(curryear) = cyear(Date())
                        Glen Schild



                        My Blog

                        Comment


                          #13
                          Re: .AND.

                          Originally posted by Steve Wood View Post
                          There is no such thing as a "checkbox" field, but I assume you mean Logical.

                          If curryear is a date field then "curryear = cyear(date())" is never going to work because the result from cyear(date()) is just "2013" and you are asking is {5/4/2013} = "2013".

                          You'd want this:

                          cyear(Curryear) = cyear(date())...

                          Your long filter: CURRYEAR=CYEAR(Date()).AND.R1.OR.CURRYEAR=CYEAR(Date())...
                          Is the same as: Curryear = cyear(date()) .and. (r1 .or. r2....)
                          Good Morning All,

                          Steve hit the nail on the head. "KA-BOOM!" It works beautifully!! Thank you sooooooo much.

                          A Big thank you to the others who offered suggestions. I really appreciate your efforts.
                          TYVM :) kenn

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

                          Comment

                          Working...
                          X