Understanding Session Filters in Exercise 9.4

Hi everyone,

Regarding the exercise 9.4, I am having a hard time understanding the filters implemented using session variables in steps c) and d) in page 5.


In step c):

c) Replace the first Filter for the following expression: 
Movie.Title like "%" + Session.MovieNameOrPlotFilter + "%" or Movie.PlotSummary like "%" + Session.MovieNameOrPlotFilter + "%" 

I understand how: Movie.Title like "%" would work, but how does + Session.MovieNameOrPlotFilter work in this context?


In step d):

d) Replace the second Filter for the following expression: 
Session.MovieGenreFilter = NullIdentifier() or Movie.GenreId = Session.MovieGenreFilter

From my understanding at first look, this meant that the NullIdentifier() function is called and placed into the Session.MovieGenreFilter; or, the Session.MovieGenreFilter gets placed into Movie.GenreId.

I am not understanding how the combo box understood this. From a programming standpoint, the combo box would rely on the if condition for it to work. However, I don't see where the if condition is used here to differentiate the different selections in the combo box.


Any explanations and insight to this to help me understand would be awesome. Thanks in advance! :)

 

9.4xSessionHandlingExercise.pdf

Hi Clifford,

Session variable persists throughout that particular session of that user. Let me explain you with an example. Let's say you logged into the application and search for a movie Titanic. The text Titanic will be stored in MovieNameOrPlotFilter session variable. If you move across different pages of the application, the variable MovieNameOrPlotFilter still holds the text Titanic. So you go to some other pages and come back to the search page, it still has the search word Titanic and displays results for it. It gets destroyed when you logout or that particular session gets expired. This was the concept which the team tried to explain over the exercise. 

For Session.MovieGenreFilter = NullIdentifier() or Movie.GenreId = Session.MovieGenreFilter - you are defining a OR condition. The session variable can be either empty (nullidentifier) or it has an identifier value (stored in MovieGenereFilter). 

If it is null, then all the results without any Movie Genre filter is considered while fetching the Aggregate results.

If it has an GenreId, then the results with that particular Genre will be fetched in the Aggregate results.

This is how you need to understand.

Hello Clifford,

In step C) the first filter is matching each record movie.title attribute with the Session variable MovieNameOrPlotFilter. if it doesn't match, it will then try to match the same records Movie.PlotSummary attribute with the same session variable. If there is a match in one or the other, that record is returned.


In step D) the filter is checking if the session Session.MovieGenreFilter is null, if so, it will return all the records, if it's not null, it will return the records that matches with the Session.MovieGenreFilter.


Was this helpfull? Please let me know if you still have any doubts.


Regards,

Frederico

Hi Clifford,

Session variable persists throughout that particular session of that user. Let me explain you with an example. Let's say you logged into the application and search for a movie Titanic. The text Titanic will be stored in MovieNameOrPlotFilter session variable. If you move across different pages of the application, the variable MovieNameOrPlotFilter still holds the text Titanic. So you go to some other pages and come back to the search page, it still has the search word Titanic and displays results for it. It gets destroyed when you logout or that particular session gets expired. This was the concept which the team tried to explain over the exercise. 

For Session.MovieGenreFilter = NullIdentifier() or Movie.GenreId = Session.MovieGenreFilter - you are defining a OR condition. The session variable can be either empty (nullidentifier) or it has an identifier value (stored in MovieGenereFilter). 

If it is null, then all the results without any Movie Genre filter is considered while fetching the Aggregate results.

If it has an GenreId, then the results with that particular Genre will be fetched in the Aggregate results.

This is how you need to understand.

Hello Clifford,

In step C) the first filter is matching each record movie.title attribute with the Session variable MovieNameOrPlotFilter. if it doesn't match, it will then try to match the same records Movie.PlotSummary attribute with the same session variable. If there is a match in one or the other, that record is returned.


In step D) the filter is checking if the session Session.MovieGenreFilter is null, if so, it will return all the records, if it's not null, it will return the records that matches with the Session.MovieGenreFilter.


Was this helpfull? Please let me know if you still have any doubts.


Regards,

Frederico

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.