4 Replies Latest reply: May 15, 2014 9:54 AM by Gareth Horton RSS

    Filter not working as expected

    michaeljul _

      I have a report that shows a lot of shipments going from USA (PORCTR="US") and to the USA (PODCTR="US) - now, there are some records that show both PORCTR and PODCTR as "US" (these are returned shipments), and I thought I could eliminate these by putting on a simple filter: PORCTR<>"US" .AND. PODCTR<>"US" - That, however does NOT work - it gives me only records that neither have receipt nor delivery in the US. Why??? Is that not an error??????

        • Filter not working as expected
          Grant Perkins

          Michael,

           

          I think it has something to do with the non specificity of <>. If you were to use = as a replacement I think you would only get those records with US in both fields. (Not tried a test though!)

           

          You could try

           

          PORCTR<>"US" .AND. PODCTR=PORCTR

           

          I suppose.

           

          If I get time later I may have a play.

           

           

          Grant

          • Filter not working as expected
            michaeljul _

            Thanks, Grant - would appreciate if one of the Datawatch techies could give me the actual reason - find it disturbing that this doesnt work and would like to understand exactly why.

            • Filter not working as expected
              Bruce _

              Michael,

               

              One thing that MIGHT happen is that one field has "US" and another "US " (with an extra space). If that were the case the filter would not work.

               

              Food for thought.

              • Filter not working as expected
                Gareth Horton

                Michael

                 

                This expression will work:

                 

                .Not. (PORCTR="US" .And. PODCTR="US")

                 

                Additionally, if you want to ensure that no returned shipments are included, irrespective of their source & destination:

                 

                PORCTR<>PODCTR

                 

                 

                By way of explanation, what your expression says:

                 

                PORCTR<>"US" .AND. PODCTR<>"US"

                 

                is first, create a list of records that do not contain "US" in the PORCTR field.  Then create a list of records that do not contain "US" in the PODCTR field.

                 

                (At this stage, you can see you will never have any records containing "US".)

                 

                Now give me all the matching records in those lists.

                 

                This expression:

                .Not. (PODCTR="US" .And. PORCTR="US") is saying:

                 

                Create a list of records that contain "US" in the PODCTR field.  Then create a list of records that contain "US" in the PORCTR Field.

                 

                Now give me all the matching records in those lists.

                 

                After that, give me all the other records that do not match.

                 

                 

                Gareth

                 

                 

                Originally posted by michaeljul:

                I have a report that shows a lot of shipments going from USA (PORCTR="US") and to the USA (PODCTR="US) - now, there are some records that show both PORCTR and PODCTR as "US" (these are returned shipments), and I thought I could eliminate these by putting on a simple filter: PORCTR<>"US" .AND. PODCTR<>"US" - That, however does NOT work - it gives me only records that neither have receipt nor delivery in the US. Why??? Is that not an error?????? /b[/quote]