NetTalk Central

Author Topic: Location of Filter String in a Browse  (Read 3438 times)

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Location of Filter String in a Browse
« on: November 02, 2015, 01:27:29 AM »
Using a Filter String
Hi Bruce referring to the Webinar82 last Thursday. at the 0.09 minute mark you were talking to Bijan about storing String filters into variable.
Was there a reason that you ignored  the Start of Browse Filter embed point and suggested that the variable be generated and inserted somewhere here before the first
  ThisView{prop:Filter} = loc:FilterWas
 code
---->
  TableQueue.Kind = Net:RowData
  if p_web.sqlsync then p_web.RequestData.WebServer._Wait().
  Open(ThisView)
  If Loc:LocateField = 'EPFSAUTHD:AMECB_CLAIM_STATUS_DATE' then Loc:NoBuffer = 1.
  If Loc:NoBuffer = 0
    Buffer(ThisView,10,0,0,0) ! causes sorting error in ODBC, when sorting by Decimal fields.
  End
  If Instring('epfsauthd:guid',lower(loc:vorder),1,1) = 0 !and EPFSAuthDirect{prop:SQLDriver} = 1
    loc:vorder = Choose(loc:vorder='','UPPER(EPFSAUTHD:GUID)',clip(loc:vorder) & ',' & 'UPPER(EPFSAUTHD:GUID)')
  End
  Loc:Selected = Choose(p_web.IfExistsValue('EPFSAUTHD:GUID'),p_web.GetValue('EPFSAUTHD:GUID'),p_web.GetSessionValue('EPFSAUTHD:GUID'))
  ThisView{prop:order} = p_web.CleanFilter(ThisView,clip(loc:vorder))
  ThisView{prop:Filter} = loc:FilterWas
  Loc:LocatorValue = p_web.GetLocatorValue(Loc:LocatorType,loc:divname,Net:Both,Loc:LocateOnFields)
  ! Start of "Browse Filter"
  ! [Priority 5000]

Whenever I have had to create a complex Filter I have used The Start of Browse Filter embed like this
FilterStrings  GROUP,PRE(FILT) ! ID:10cd7318-32e4-4a31-8ee7-af94f98857b5
PolicyNoFilter   STRING(255) ! ID:1c8f205e-2f83-43c6-a258-71f22b99e669
AccountNoFilter  STRING(255) ! ID:68efe260-0643-4854-8e6d-b6191eb65e82
ClaimNoFilter    STRING(255) ! ID:eac9f357-6be8-45f2-8045-714bf2efae18
SurnameFilter    STRING(255) ! ID:b244516c-17e8-48ec-a9a3-3a3a69b4d274
IMEIFilter       STRING(255) ! ID:3be55dda-dd36-4e24-8c5a-0c3d964a99ef
ContactFilter    STRING(255) ! ID:43fda989-5702-4e2d-a2c9-04784cdfc734
IDNOFilter       STRING(255) ! ID:d2afb19d-7d90-45f6-be08-1e29a2eb4171
               END
CLEAR(FilterStrings)
IF p_web.GSV('PolicyNo') <> ''
    FILT:PolicyNoFilter = 'EPFSAUTHD:AMECB_POLICY_NBR = <39>' & p_web.GSV('PolicyNo') & '<39>'
END
IF p_web.GSV('AccountNo') <> ''
    FILT:AccountNoFilter = 'EPFSAUTHD:AMECB_ACCT = <39>' & p_web.GSV('AccountNo') & '<39>'
END
IF p_web.GSV('ClaimNo') <> ''
    FILT:ClaimNoFilter = 'EPFSAUTHD:AMECB_CLAIM_NBR = <39>' & p_web.GSV('ClaimNo') & '<39>'
END
IF p_web.GSV('Surname') <> ''
    FILT:SurnameFilter = 'EPFSAUTHD:AMECE_N_SURNAME = <39>' & p_web.GSV('Surname') & '<39>'
END
IF p_web.GSV('ClaimIDNo') <> ''
    FILT:IDNOFilter = 'EPFSAUTHD:IDNo = <39>' & p_web.GSV('ClaimIDNo') & '<39>'
END
IF p_web.GSV('IMEI') <> ''
    FILT:IMEIFilter = 'EPFSAUTHD:AMECE_CP_IMEI_NBR = <39>' & p_web.GSV('IMEI') & '<39>'
END
IF p_web.GSV('CustomerContactNumber') <> ''
    FILT:ContactFilter = 'EPFSAUTHD:CustomerContactNumber = <39>' & p_web.GSV('CustomerContactNumber') & '<39>'
END
loc:FilterWas = CLIP(FILT:PolicyNoFilter)
IF FILT:AccountNoFilter <> ''
    IF LEN(CLIP(loc:FilterWas)) <> 0
        loc:FilterWas = CLIP(loc:FilterWas) & ' AND ' & CLIP(FILT:AccountNoFilter)
    ELSE
        loc:FilterWas = CLIP(FILT:AccountNoFilter)
    END
END
IF FILT:ClaimNoFilter <> ''
    IF LEN(CLIP(loc:FilterWas)) <> 0    
        loc:FilterWas = CLIP(loc:FilterWas) & ' AND ' & CLIP(FILT:ClaimNoFilter)
    ELSE
        loc:FilterWas = CLIP(FILT:ClaimNoFilter)
    END
    
END
IF FILT:SurnameFilter <> ''
    IF LEN(CLIP(loc:FilterWas)) <> 0        
        loc:FilterWas = CLIP(loc:FilterWas) & ' AND ' & CLIP(FILT:SurnameFilter)
    ELSE
        loc:FilterWas = CLIP(FILT:SurnameFilter)
    END
        
END
IF FILT:IDNOFilter <> ''
    IF LEN(CLIP(loc:FilterWas)) <> 0        
        loc:FilterWas = CLIP(loc:FilterWas) & ' AND ' & CLIP(FILT:IDNOFilter)
    ELSE
        loc:FilterWas = CLIP(FILT:IDNOFilter)
    END
        
END
IF FILT:IMEIFilter <> ''
    IF LEN(CLIP(loc:FilterWas)) <> 0
        loc:FilterWas = CLIP(loc:FilterWas) & ' AND ' & CLIP(FILT:IMEIFilter)
    ELSE
        loc:FilterWas =  CLIP(FILT:IMEIFilter)            
    END
            
END
IF FILT:ContactFilter <> ''
    IF LEN(CLIP(loc:FilterWas)) <> 0
        loc:FilterWas = CLIP(loc:FilterWas) & ' AND ' & CLIP(FILT:ContactFilter)
    ELSE
        loc:FilterWas = CLIP(FILT:ContactFilter)                
    END
                
END
IF LEN(CLIP(loc:FilterWas)) = 0
    loc:FilterWas = 'EPFSAUTHD:AMECB_ACCT = <39>xx<39>'
END


ThisView{prop:Filter} = loc:FilterWas  

Is there a reason that this is incorrect?
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Location of Filter String in a Browse
« Reply #1 on: November 03, 2015, 12:26:51 AM »
Both approaches are fine Terry.

Cheers
Bruce