NetTalk Central

Author Topic: Cannot get dopdown filter to work  (Read 7448 times)

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Cannot get dopdown filter to work
« on: February 15, 2011, 04:05:58 PM »
Here's the filter in question:

'((BRE:BreedCode % 100) <> 0) and BRE:BreedName <> ''NOT ALLOWED'''

This filter works fine in a standard ABC browse.  I cannot get it to work in NetTalk.  Does it have something to do with session values?

Clarion 6.1 9033
NetTalk 4.56

Thanks,
Don
« Last Edit: February 19, 2011, 06:40:29 PM by DonRidley »
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Cannot get dopdown filter to work
« Reply #1 on: February 15, 2011, 10:07:18 PM »
no, I don't think it's session value related. Both your "right hand sides" are constants, not variables.

The filter looks pretty good actually - although the string comparison is case sensitive, so it must be in the table as NOT ALLOWED not Not Allowed or something.

When you say it's not working - is it filtering too many rows out, or is it not filtering enough rows out?

Cheers
Bruce

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Cannot get dopdown filter to work
« Reply #2 on: February 16, 2011, 03:04:26 AM »
This might sound silly, but have you added BRE:Breedcode and BRE:Breedname in Hotfields?


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Cannot get dopdown filter to work
« Reply #3 on: February 16, 2011, 06:18:55 AM »
>> This might sound silly, but have you added BRE:Breedcode and BRE:Breedname in Hotfields?

I don't think you'd need to. Fields in the filter don't have to be projected in the View.

Cheers
Bruce

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Cannot get dopdown filter to work
« Reply #4 on: February 16, 2011, 10:42:51 AM »
BRE:BreedCode and BRE:BreedName are both hot fields.

The filter just does not filter anything.  No effect whatsoever on the dropdown list.  No hand code to effect it either.

I have even tried very simple filters like:  'BRE:BreedCode = 100' (Where I know a value of 100 exists) and nothing happens.

It just does not make sense as I have used filters in NT4 and 5 many times without problems.

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Cannot get dopdown filter to work
« Reply #5 on: February 16, 2011, 02:42:45 PM »
If Breedcode is a string try

'BRE:BreedCode = <39>100<39>'

I would also drop in some debug code after the filter is set so you can actually see what it is generating.

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Cannot get dopdown filter to work
« Reply #6 on: February 16, 2011, 03:10:20 PM »
I shouldn't be a string but I'm "repairing" an app made by another developer so anything is possible.  I'll check on that and that is a good point.  However, I know BRE:BreedName is a string and a cannot filter on it either.

Thanks for the reply,

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Cannot get dopdown filter to work
« Reply #7 on: February 16, 2011, 09:15:33 PM »
Since it's clearly nothing obvious;

Are you sure the dropdown is on the BRE file and not perhaps an Alias of the BRE file?

You should perhaps take a look at the generated code to see if that helps you spot the issue.

cheers
Bruce

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Cannot get dopdown filter to work
« Reply #8 on: February 17, 2011, 03:42:01 AM »
Here's the generated code for the dropdown:

I do not see anything wrong:

Value::DOG:BreedCode  Routine
  p_web._DivHeader('DogForm_' & p_web._nocolon('DOG:BreedCode') & '_value','adiv')
  loc:extra = ''
  ! --- DROPLIST ---
  loc:fieldclass = 'FormEntry'
  If lower(loc:invalid) = lower('DOG:BreedCode')
    loc:fieldclass = clip(loc:fieldclass) & ' ' & 'formerror'
  ElsIf loc:retrying ! any field on the form is invalid
    p_web._OpenFile(BREED)
    BRE:BreedCode = DOG:BreedCode
    If p_web._getfile(BREED,BRE:KeyBreedCode)
      loc:fieldclass = clip(loc:fieldclass) & ' ' & 'formerror'
    End
    p_web._CloseFile(BREED)
  End
  loc:even = 1
  loc:javascript = ''
  loc:javascript = clip(loc:javascript) & ' onchange="'&p_web._nocolon('sv(''DOG:BreedCode'',''dogform_dog:breedcode_value'',1,FieldValue(this,1))')&';'
  if loc:javascript <> '' then loc:javascript = clip(loc:javascript) & '"'.
  loc:readonly = Choose(loc:viewonly,'disabled','')
  packet = clip(packet) & p_web.CreateSelect('DOG:BreedCode',loc:fieldclass,loc:readonly,,,,loc:javascript,)
  p_web.translateoff += 1
  pushbind()
  p_web._OpenFile(DOGMAST)
  bind(DOG:Record)
  p_web._OpenFile(BREED)
  bind(BRE:Record)
  p_web._OpenFile(CUSTOMER)
  bind(CUS:Record)
  p_web._OpenFile(COUNTRY)
  bind(CNTRY:Record)
  if p_web.sqlsync then p_web.RequestData.WebServer._Wait().
  open(DOG:BreedCode_OptionView)
  DOG:BreedCode_OptionView{prop:order} = 'UPPER(BRE:BreedName)'
  ! Start of "Option Filter & Order"
  ! [Priority 5000]
  !Filter would go here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ! End of "Option Filter & Order"
  Set(DOG:BreedCode_OptionView)
  Loop
    Next(DOG:BreedCode_OptionView)
    If ErrorCode() then Break.
    ! Start of "Validate Drop Field Record"
    ! [Priority 5000]
    
    End of "Validate Drop Field Record"
    if p_web.IfExistsSessionValue('DOG:BreedCode') = 0
      p_web.SetSessionValue('DOG:BreedCode',BRE:BreedCode)
    end
        loc:rowstyle = choose(sub(' SelectList',1,1)=' ',clip(loc:fieldclass) & clip(' SelectList') & loc:even,clip(' SelectList') & loc:even)
    packet = clip(packet) & p_web.CreateOption(BRE:BreedName,BRE:BreedCode,choose(BRE:BreedCode = p_web.getsessionvalue('DOG:BreedCode')),clip(loc:rowstyle),,) &CRLF
    loc:even = Choose(loc:even=1,2,1)
    do SendPacket
  End
  Close(DOG:BreedCode_OptionView)
  p_web.translateoff -= 1
  if p_web.sqlsync then p_web.RequestData.WebServer._Release().
  p_Web._CloseFile(DOGMAST)
  p_Web._CloseFile(BREED)
  p_Web._CloseFile(CUSTOMER)
  p_Web._CloseFile(COUNTRY)
  PopBind()
  packet = clip(packet) & '</select>'&CRLF
  do SendPacket
  p_web._DivFooter()
  p_web._RegisterDivEx('DogForm_' & p_web._nocolon('DOG:BreedCode') & '_value')
« Last Edit: February 17, 2011, 04:55:26 AM by DonRidley »
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Cannot get dopdown filter to work
« Reply #9 on: February 17, 2011, 03:55:54 AM »
Maybe I'm blind, but where is the Filter?


  ! Start of "Option Filter & Order"
  ! [Priority 5000]
   
  ! End of "Option Filter & Order"

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Cannot get dopdown filter to work
« Reply #10 on: February 17, 2011, 04:56:26 AM »
When copied and pasted, I didn't have the filter in there.  My main goal was to supply the code and maybe someone can see of something other than the filter is not right.

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Cannot get dopdown filter to work
« Reply #11 on: February 17, 2011, 11:38:48 PM »
Please post the declaration of DOG:BreedCode_OptionView
from your code.

cheers
Bruce

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Cannot get dopdown filter to work
« Reply #12 on: February 19, 2011, 05:28:01 PM »
DOG:BreedCode_OptionView   View(BREED)
                          Project(BRE:BreedCode)
                          Project(BRE:BreedName)
                          Project(BRE:BreedCode)
                          Project(BRE:BreedName)
                          JOIN(BRE:KeyBreedCode,DOG:BreedCode),INNER
                            Project(DOG:BreedCode)
                          End

Procedure's source code attached....

Thanks!!!!!


[attachment deleted by admin]
« Last Edit: February 19, 2011, 06:41:06 PM by DonRidley »
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Cannot get dopdown filter to work
« Reply #13 on: February 20, 2011, 10:53:01 PM »
I notice the View has a JOIN in it;

                          JOIN(BRE:KeyBreedCode,DOG:BreedCode),INNER
                            Project(DOG:BreedCode)
                          End

Which I suppose means you've added DOG:BreedCode as a Hot-Field to the lookup settings? Remove that (it's not necessary at all) and see if that helps.

Cheers
Bruce

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Cannot get dopdown filter to work
« Reply #14 on: February 21, 2011, 05:34:45 AM »
That did it!!!!   Thank you Bruce!!!!!!!!!
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11