NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Matthew51 on July 08, 2009, 02:31:11 PM

Title: Filter a browse based on the menu choice
Post by: Matthew51 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.
Title: Re: Filter a browse based on the menu choice
Post by: Alberto 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
Title: Re: Filter a browse based on the menu choice
Post by: Bruce 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

Title: Re: Filter a browse based on the menu choice
Post by: Matthew51 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.
Title: Re: Filter a browse based on the menu choice
Post by: Bruce 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.
Title: Re: Filter a browse based on the menu choice
Post by: Matthew51 on July 10, 2009, 11:05:58 AM
I had already removed it for testing.
Title: Re: Filter a browse based on the menu choice
Post by: Bruce 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