NetTalk Central

Author Topic: Filter a browse based on the menu choice  (Read 3246 times)

Matthew51

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • Email
Filter a browse based on the menu choice
« on: July 08, 2009, 02:31:11 PM »
I want to have multiple menu items that all call the same browse, but filter it differently.  My idea was to store the filter in a session value, but I can not find the correct place to set the value.  If I set it in an embed point for the menu item then all embed point look to get executed in the order of the menu items.  Meaning only the last filter will ever be used regardless of which menu item the user clicked on.  Setting the value with the "onClick" field seems to have the same result.

I'm using NetTalk 4.31 by the way.
Contractor with 10+ years of NetTalk experience looking for work.
www.linkedin.com/in/matthew-leavitt
BisWare.ca
Check out my free EasyTime Template

Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Filter a browse based on the menu choice
« Reply #1 on: July 08, 2009, 02:50:16 PM »
Hi Matt,

Call the browse from the menu adding a paremeter value to the URL like:

MyBrowse?Filter=IdFilter

IdFilter is anythig you want to identify the filter.

In the Browse itself, Embed Before Browse Loop/ After setting browse....
save the Parameter to a session value like:

p_web.ssv('IdFilter',p_web.GetValue('Filter')

Then in the SetFilter Embed you can check for the session value and decide what filter to use, like:

if p_web.gsv('IdFilter')='whatever'
    loc:FilterWas = 'your filter'
end


Hope this helps
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: Filter a browse based on the menu choice
« Reply #2 on: July 08, 2009, 09:52:14 PM »
Almost correct.
this bit is wrong;

In the Browse itself, Embed Before Browse Loop/ After setting browse....
save the Parameter to a session value like:
p_web.ssv('IdFilter',p_web.GetValue('Filter')

Because it will clear the SessionValue if the parameter does not exist. And since the parameter does not exist for any of the async class it will quickly break your filter.

The correct way to store a parameter in the session queue is to use the StoreValue method.
p_web.StoreValue('IdFilter')

And of course your parameter should then match the Value name- ie
MyBrowse?IdFilter=whatever

Cheers
Bruce


Matthew51

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • Email
Re: Filter a browse based on the menu choice
« Reply #3 on: July 09, 2009, 03:02:51 PM »
I did all that, and the filter looks to work for about a half second, then the browse is displayed without a filter.  I checked the values of loc:FilterWas and IdFilter and they are always correct.
Contractor with 10+ years of NetTalk experience looking for work.
www.linkedin.com/in/matthew-leavitt
BisWare.ca
Check out my free EasyTime Template

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: Filter a browse based on the menu choice
« Reply #4 on: July 10, 2009, 12:05:25 AM »
have you got a timer on the browse?

If you do, remove it for testing. You can "refresh" the browse page by clicking a header, or next button or something like that.

let me know what happens with that test.

Matthew51

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • Email
Re: Filter a browse based on the menu choice
« Reply #5 on: July 10, 2009, 11:05:58 AM »
I had already removed it for testing.
Contractor with 10+ years of NetTalk experience looking for work.
www.linkedin.com/in/matthew-leavitt
BisWare.ca
Check out my free EasyTime Template

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: Filter a browse based on the menu choice
« Reply #6 on: July 12, 2009, 09:17:59 PM »
I think you'll need to post an example of what you are doing here Matthew.

Cheers
Bruce