Forums

Search view with url data:parameter

mikezf 03 Apr, 2017
Hi Max,
one more question to the topic "Search View" in CCv6.
I'm using one url parameter as data:parameter in the where condition in function that reads data.
No I want to use Search view. But after reloading the Read Data function in index ivent as the result of Search view,
this data:parameter is empty and the where condition gives of course null.
I tried to use the Session function and instruction to store this parameter
but I'm sure I'm doing it wrong, mayby I undestand it's purpose wrong.
Can you help me?

Regards,
Mike
mikezf 03 Apr, 2017
Max, found solution and good example in "Article relations" custom project.
Regards,
Mike
Max_admin 03 Apr, 2017
Hi Mike,

You can always store the data in the session using a session function when the data is available and then read from the session variable later instead of reading from the data.

There is also a possibility to do some kind of comparison in the data providers this way:

{data:param}|{session:fn_session_name}

This instructs the provider to check the data param, if its not available then get the next value which is the session.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mikezf 04 Apr, 2017
Thank you Max for your replay.
I see at the custom example that there is also an option {session/clear:session_key}.
Should the "clear" instruction be always used in conjunction with the session function
for perhaps releasing memory. Or is it not nessesary? I use it in index event tab as followed:

{fn:save_to_session} /* to save at startup the parameter of the where condition */
...
{fn:read_data}
{view:data_list}
...

But I cannot find a correct place for the 'clear' instruction. Puting this at the end of the index event gives wrong result.

Regards,
Mike
Max_admin 04 Apr, 2017
Hi Mike,

After calling {fn:save_to_session}, you can use {session:save_to_session}, it will have the data of the data provider used in the session function, but once you call {session/clear:save_to_session}, that data will be cleared.

What are you trying to do exactly ?

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mikezf 04 Apr, 2017
I am calling a the connection with a url parameter, to filter data. Then I want to search this data with the search view.
Search view calls the index event again, but the url parameter gets lost. Therefore I save the url parameter with the session
function at the beginning of the index event. This url parameter is used next in the data read function in where condition:

Model.param1:{session:save_to_session.url_param}|{data:url_param}
AND
Model.param2/LIKE:%{data:keywords}%

Search view is looping the index event (as I undestand). So I'm thinking there is no place to clear the session.
My question at this point: Clearing session means "realise memory" (in understanding "new" & "release" of dynamic memory)
or is it only nulling the value? Because calling the search view more times could make running memory out of limit?

Regards,
Mike
Max_admin 04 Apr, 2017
Hi Mike,

Calling clear nulls the session value, we don't care about memory here.

I think that this line:
Model.param1:{session:save_to_session.url_param}|{data:url_param}

should be:
Model.param1:{data:url_param}|{session:save_to_session.url_param}

which means, try to get the url parameter first, and only if its not available, try to get the session value, but you have it the opposite way.

The next update will set the url of all views to the current url by default, so you will not have the problem of needing to store the data parameter somewhere because the search view will not lose it, but its still good to store it, you may need this for example if the user goes to a different page, and goes back to the listing, the data variable will be lost in this situation.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mikezf 04 Apr, 2017
Thank you Max.
It is working so and so.
But without storing the url parameter in the session the next update after search view did not set the url with the previous url parameter. This url parameter is omitted. Its value is also not viewed in debug output. So I think you are wrong.
With storing in the session it is working well.

Regards,
Mike
Max_admin 04 Apr, 2017
Answer
Hi Mike,

Storing in the session should be fine, but I was saying that in the next Connectivity update, the search view default url will retain the url parameters available, not the post variables though, so the session storage is good and necessary.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mikezf 04 Apr, 2017
"The next update" means the next update of CC and not update the index event. No I understand.
OK Max, that will be good.
Thank you for your assistance
and see you next time.

Best regards,
Mike
Max_admin 04 Apr, 2017
Hi Mike,

No problems, hopefully the next update will be available sometime this week.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.