NetTalk Central

Author Topic: Browse search defaults to AND instead of OR  (Read 2172 times)

Matthew51

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Email
Browse search defaults to AND instead of OR
« on: September 09, 2019, 03:17:59 PM »
It least for my use case I consider an AND search to make more seance as the default search rather then OR, and my users aren't going to put in the + by themselves. Also just in case I have some advanced users I added a | character to indicate an OR search.

In your WebHandler procedure modify the GetLocatorVale embed to look like:
Code: [Select]
p_web.GetLocatorValue PROCEDURE(LONG p_type,String p_name,Long p_Where,String p_OnFields)

ReturnValue          ANY

! Start of "NetTalk Method Data Section"
! [Priority 5000]
i                           LONG
st                          StringTheory

! End of "NetTalk Method Data Section"

  CODE
  ! Start of "NetTalk Method Executable Code Section"
  ! [Priority 2500]
 
  ! Parent Call
  ReturnValue = PARENT.GetLocatorValue(p_type,p_name,p_Where,p_OnFields)
  ! [Priority 7500]
 
  ! End of "NetTalk Method Executable Code Section"
! Start of "NetTalk Method Routine Section"
! [Priority 5000]
    IF p_type = Net:Search
        st.SetValue(Clip(ReturnValue))
        st.Split(' ', '"')
        LOOP i = 2 TO st.Records()
            CASE Sub(st.GetLine(i), 1, 1)
            OF '-'
            OF '+'
            OF '|'
                st.SetLine(i, Sub(st.GetLine(i), 2, Len(st.GetLine(i)) -1))
            ELSE
                st.SetLine(i, '+' & st.GetLine(i))
            END
        END
        st.Join(' ')
        dbgView('Value: ' & st.GetValue())
        ReturnValue = st.GetValue()
    END

Note: In my testing I noticed a bug in netTalk where if the final ReturnValue had a + or - then quotes, ie.  (bud +"light Lime") it wouldn't remove the first quote and my filter would look something like: ( INSTRING('BUD',UPPER(Loc:Description),1,1) <> 0) AND ( INSTRING('"LIGHT LIME',UPPER(Loc:Description),1,1) <> 0)


Contractor with 10+ years of NetTalk experience looking for work.
www.linkedin.com/in/matthew-leavitt
BisWare.ca
Check out my free EasyTime Template