10 Replies Latest reply on Dec 27, 2011 11:52 AM by philmodjunk

    Global portal pattern count sort question

    bookalaka_1

      Title

      Global portal pattern count sort question

      Post

      I have 4 global fields I use for sorting that work great however when using the pattern count function on the 4th field information must always be present to show records.  What would be the calculation so when nothing is displayed in all the global fields  all records will list? If I don't use the pattern count works fine and all records show. here is my filter. I tried both "OR" and xor  with no success

      Order_Entry::gSearchField 1 = Left (Products_4select_e::Code_PB_pk ; Length (Order_Entry::gSearchField 1 ) ) and Order_Entry::gSearchField 2 = Left (Products_4select_e::Code_Vint_LK; Length (Order_Entry::gSearchField 2 ) )and Order_Entry::gSearchField 3 = Left (Products_4select_e::Code_Size; Length (Order_Entry::gSearchField 3 ) ) and PatternCount ( Products_4select_e::c_ItemName;Order_Entry::gSearchField 4 )

       

      Thanks

        • 1. Re: Global portal pattern count sort question
          philmodjunk

          Use:

          IsEmpty ( gSearchField1 & gSearchField2 & gSearchField3 ) or (//put the rest of your expression here )

          • 2. Re: Global portal pattern count sort question
            bookalaka_1

            this doesnt give the result I need prevents the global fields from doing finds.  when not using the pattern count i am able to search list and will sort correctly;

            gfld 1 sorts code: item code

            gfld 2 sorts size: is a number

            gflld 3 sorts vintage

            gfld 4 sorts: by word search to locate grape variety or area - of course this is not working

             

            IsEmpty ( Order_Entry::gSearchField 1 & Order_Entry::gSearchField 2 & Order_Entry::gSearchField 3) or (Order_Entry::gSearchField 1 = Left (Products_4select_e::Code_PB_pk ; Length (Order_Entry::gSearchField 1 ) ) and Order_Entry::gSearchField 2 = Left (Products_4select_e::Code_Vint_LK; Length (Order_Entry::gSearchField 2 ) )and Order_Entry::gSearchField 3 = Left (Products_4select_e::Code_Size; Length (Order_Entry::gSearchField 3 ) )and PatternCount ( Products_4select_e::c_ItemName;Order_Entry::gSearchField 4 ) )

            • 3. Re: Global portal pattern count sort question
              philmodjunk

              It does indeed work. I've used it in my own solutions. (I did misread your first post and left out one global field here.)

              IsEmpty ( Order_Entry::gSearchField 1 & Order_Entry::gSearchField 2 & Order_Entry::gSearchField 3 & Order_Entry::gSearchField 4)

              will only be true if all four fields are empty. Thus, if you've entered text in any one of the fields, it is not true and the calculation ignores it.

              Hmm, perhaps it "works" but not in the way you need it to....

              What I was trying to set up is to have all records listed if all search fields are empty. Is it possible you just want to have the pattern count clause not affect the results if the 4th search field is empty?

              If so:

              Order_Entry::gSearchField 1 = Left (Products_4select_e::Code_PB_pk ; Length (Order_Entry::gSearchField 1 ) ) and
              Order_Entry::gSearchField 2 = Left (Products_4select_e::Code_Vint_LK; Length (Order_Entry::gSearchField 2 ) )and
              Order_Entry::gSearchField 3 = Left (Products_4select_e::Code_Size; Length (Order_Entry::gSearchField 3 ) ) and
              ( IsEmpty ( Order_Entry::gSearchField 4 ) or PatternCount ( Products_4select_e::c_ItemName;Order_Entry::gSearchField 4 ) )

              • 4. Re: Global portal pattern count sort question
                bookalaka_1

                Yes the 2nd is what I wanted.

                Thank You

                • 5. Re: Global portal pattern count sort question
                  bookalaka_1
                   Adding to this script have not been able to solve another parameter.  I have a field in my portal "Date called" in my table I have created 3 global fields "datefrom" "dateto" and a calculation "datespan". I have been able to filter the portal when I use orderentry::searchfield_datefrom=portalitems_datecalled but have been unsuccessful in searching with the "date span"  am I going about this the right way? Thanks For direction
                  • 6. Re: Global portal pattern count sort question
                    philmodjunk

                    I'll need more detailed info on what you have set up.

                    • 7. Re: Global portal pattern count sort question
                      bookalaka_1

                      Ultimately my question is how do I do a date range search in my portal?  My idea was to create global fields "DateFrom Field" entry 9/1/2011 and a "DateTo Fields" entry 9/15/2011 with a calculation field being "DateSpan" gives me the range 9/1/2011...9/15/2011.  My portal field entry I wish to search and filter is "DateCalled"  .

                      I know how to do this in a list view by going into a find mode and inserting the date range but I am stumped in the portal view.

                      Currently portal is  filtered using global fields by AccountName, WineCode, QuarterFocus,  NameSearch

                      Order_Entry::gSearchField_UCR_AccntName= Left (UNIV_ITEMS X OE::AccountName ; Length (Order_Entry::gSearchField_UCR_AccntName) ) and Order_Entry::gSearchField_UCR_WineCode= Left (UNIV_ITEMS X OE::Code_PB_pk ; Length (Order_Entry::gSearchField_UCR_WineCode) )and Order_Entry::gSearchField_UCR_Qtr= Left (UNIV_ITEMS X OE::Qtr_Focus_Calc ; Length (Order_Entry::gSearchField_UCR_Qtr) ) and ( IsEmpty ( Order_Entry::gSearchField_UCR_Item ) or PatternCount ( UNIV_ITEMS X OE::Presentation_Calc; Order_Entry::gSearchField_UCR_Item ) ) and ( IsEmpty ( Order_Entry::gSearchField_UCR_FollowUp ) or PatternCount ( UNIV_ITEMS X OE::Evaluation_1; Order_Entry::gSearchField_UCR_FollowUp )

                       

                      Thank you

                       

                      • 8. Re: Global portal pattern count sort question
                        philmodjunk

                        Use a pair of inequalities in your expression instaead of a date range--which is only good as find criteria.

                        Order_Entry::DateCalled > Order_Entry::gDateFrom And Order_Entry::Datecalled < Order_Entry::gDateTo

                        • 9. Re: Global portal pattern count sort question
                          bookalaka_1

                          Some very strange behavior is occuring when using November dates? my actual coding is

                          UNIV_ITEMS X OE::Date_Called  ≥ Order_Entry::gSearchField_UCR_DateFrom and UNIV_ITEMS X OE::Date_Called  ≤  Order_Entry::gSearchField_UCR_DateTo

                          When i do a search in December  from 12/1/2011 to 12/28/2011 or any other date from in December portal sorts correctly. If I use  FROM 11/1/2011 to 12/28/2011 all the dates are fine. Where it gets weird is if I sort From 11/9/2011 To 12/28/2011 only 11/9/2011 and the dates in December show up? I am missing November 10th and beyond. if I start from 11/15 all the dates in November show up? When I go to October all dates work perfectly. Is there something I am missing this seems really odd.

                           

                          • 10. Re: Global portal pattern count sort question
                            philmodjunk

                            That does seem odd. Clearly the fields are of type date or this wouldn't work at all. I suspect the index for the field may be corrupted.

                            Try this process for re-indexing your Date_Called field:

                            Open Manage | Database | Fields and double clicke the date_called field definition.

                            Click the storage tab and set indexing to "off".

                            Click OK to dismiss the dialog box and click OK to commit this change to the database.

                            Now, re-open Manage | database and turn indexing for this field back on.

                            Now test again and see if you get the results you expect.