Results Navigation...another look

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

jasonhuck
You can also use Johan's [found_rows] tag and pass that value to
-found instead of [found_count]:

http://tagswap.net/found_rows

- jason



On Wed, Aug 20, 2008 at 5:48 AM, Wade Maxfield <[hidden email]> wrote:

> Viaduct Productions wrote:
>>
>> ...an update:
>>
>> The current issue now is that the inside conditionals create an issue:
>>
>> if(#found_count > #shown_count);
>>
>> found has to be more than maxrecords_value.  That is a tough one using the
>> LIMIT in sql.  Deco and I are trying to get this to work with mysql.  Trying
>> to use the full LIMIT syntax (LIMIT (offset, found_count_restriction)) while
>> not using the second is confusing.
>>
>> Anybody got this to work with mysql, please chime in.  Right now the whole
>> LIMIT clause is conditional upon the action_param('skiprows'), but then that
>> is becoming doubled up in the action_params, so the syntax is really messing
>> up with multiple numbers in the LIMIT clause.
>>
>> Anybody?
>>
>>
>
> Do your SELECT statement twice.
>
> Once to find count(*), then the second to get your normal data.
>
> Inline: -sql='SELECT count(*) as found_count FROM table WHERE yyy';
>        Local: 'found_count' = (integer: (field: 'found_count'));
>        Inline: -sql='SELECT xxx FROM table WHERE yyy (LIMIT
> offset,found_count_restriction)';
>                blah, blah, blah....
>        /Inline;
> /Inline;
>
>  - Wade
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>



--
tagSwap.net :: Open Source Lasso Code
<http://tagSwap.net/>

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Viaduct Productions
In reply to this post by Wade Maxfield
Thanks for the notes.  I will take a look at how this can work.


On 20-Aug-08, at 5:48 AM, Wade Maxfield wrote:

> Do your SELECT statement twice.
>
> Once to find count(*), then the second to get your normal data.
>
> Inline: -sql='SELECT count(*) as found_count FROM table WHERE yyy';
> Local: 'found_count' = (integer: (field: 'found_count'));
> Inline: -sql='SELECT xxx FROM table WHERE yyy (LIMIT  
> offset,found_count_restriction)';
> blah, blah, blah....
> /Inline;
> /Inline;



Rich in Toronto
...now go get on your bike


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Wade Maxfield
Viaduct Productions wrote:

> Thanks for the notes.  I will take a look at how this can work.
>
>
> On 20-Aug-08, at 5:48 AM, Wade Maxfield wrote:
>
>> Do your SELECT statement twice.
>>
>> Once to find count(*), then the second to get your normal data.
>>
>> Inline: -sql='SELECT count(*) as found_count FROM table WHERE yyy';
>>     Local: 'found_count' = (integer: (field: 'found_count'));
>>     Inline: -sql='SELECT xxx FROM table WHERE yyy (LIMIT
>> offset,found_count_restriction)';
>>         blah, blah, blah....
>>     /Inline;
>> /Inline;
>

You can even get a bit smarter and only do the second inline if there
are actually records to return.

Inline: -sql='SELECT count(*) as found_count FROM table WHERE yyy';
     Local: 'found_count' = (integer: (field: 'found_count'));
     if: #found_count > 0;
         Inline: -sql='SELECT xxx FROM table WHERE yyy (LIMIT
offset,found_count_restriction)';
             blah, blah, blah....
         /Inline;
     /if;
/Inline;

  - Wade

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Viaduct Productions
In reply to this post by jasonhuck
The first page (no skiprecords) works fine.  No LIMIT in the statement.

I click 16 records in (page 3), found_count still good.  
Theoretically, this should work for all of them.

The action params, which get shoved through the form build on every  
page, is taking skiprecords more than once.  I had to take the - off  
skiprows to recognize it past Lasso's reserved words, as an action  
parameter.  The statement is now a LIMIT 16,1000, but the navigation  
still shows I'm on page 1, while the hitlist definitely reflects the  
statement.

Deco mentioned something about an old version of the tags.  The form  
build seems strange to me, so is the tagswap the latest version?


On 20-Aug-08, at 6:44 AM, Jason Huck wrote:

> You can also use Johan's [found_rows] tag and pass that value to
> -found instead of [found_count]:
>
> http://tagswap.net/found_rows



Cheers

Rich in Toronto
[hidden email]






--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Viaduct Productions
I'm not using lasso inlines as well.


On 20-Aug-08, at 7:33 AM, Viaduct Productions wrote:

> On 20-Aug-08, at 6:44 AM, Jason Huck wrote:
>
>> You can also use Johan's [found_rows] tag and pass that value to
>> -found instead of [found_count]:
>>
>> http://tagswap.net/found_rows



Cheers

Rich in Toronto
[hidden email]






--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Johan Solve
[found_rows] words equally well with -sql inlines. See the description
at tagswap:

"Lasso 8.5 and later returns the correct value for found_count when
using -uselimit with regular inlines, but when using -sql inlines this
tag is still  needed to get the correct count of found records when
having LIMIT in the query. "

A bit of warning though, there can be situations where this tag
doesn't work or performs very slowly for certain complex queries.


On Wed, Aug 20, 2008 at 1:41 PM, Viaduct Productions
<[hidden email]> wrote:

> I'm not using lasso inlines as well.
>
>
> On 20-Aug-08, at 7:33 AM, Viaduct Productions wrote:
>
>> On 20-Aug-08, at 6:44 AM, Jason Huck wrote:
>>
>>> You can also use Johan's [found_rows] tag and pass that value to
>>> -found instead of [found_count]:
>>>
>>> http://tagswap.net/found_rows
>
>
>
> Cheers
>
> Rich in Toronto
> [hidden email]
>
>
>
>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>



--
Mvh
Johan Sölve
____________________________________
Montania System AB
Halmstad Stockholm Malmö
http://www.montania.se

Johan Sölve
Mobil +46 709-51 55 70
[hidden email]

Kristinebergsvägen 17, S-302 41 Halmstad, Sweden
Telefon +46 35-136800 | Fax +46 35-136801

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Viaduct Productions
Why would found_count not work with sql queries?

Anyway I am now going through Lasso inlines, and returned the -
skiprows to its natural state.  I think Jason's tag uses that  
action_param, inserted into the inline afterwards.  As soon as I  
corrected that, she worked again.

Now to test, clean it up, and put in the "back to listings" link.


On 20-Aug-08, at 9:06 AM, Johan Solve wrote:

> [found_rows] words equally well with -sql inlines. See the description
> at tagswap:
>
> "Lasso 8.5 and later returns the correct value for found_count when
> using -uselimit with regular inlines, but when using -sql inlines this
> tag is still  needed to get the correct count of found records when
> having LIMIT in the query. "
>
> A bit of warning though, there can be situations where this tag
> doesn't work or performs very slowly for certain complex queries.



Rich in Toronto
...now go get on your bike


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Lieven Gekiere-2
In reply to this post by Johan Solve
On Wed, Aug 20, 2008 at 3:06 PM, Johan Solve <[hidden email]> wrote:

> [found_rows] words equally well with -sql inlines. See the description
> at tagswap:
>
> "Lasso 8.5 and later returns the correct value for found_count when
> using -uselimit with regular inlines, but when using -sql inlines this
> tag is still  needed to get the correct count of found records when
> having LIMIT in the query. "
>
> A bit of warning though, there can be situations where this tag
> doesn't work or performs very slowly for certain complex queries.
>
>
> On Wed, Aug 20, 2008 at 1:41 PM, Viaduct Productions
> <[hidden email]> wrote:
>> I'm not using lasso inlines as well.
>>
>>
>> On 20-Aug-08, at 7:33 AM, Viaduct Productions wrote:
>>
>>> On 20-Aug-08, at 6:44 AM, Jason Huck wrote:
>>>
>>>> You can also use Johan's [found_rows] tag and pass that value to
>>>> -found instead of [found_count]:
>>>>
>>>> http://tagswap.net/found_rows
>>
>>
>>
>> Cheers
>>
>> Rich in Toronto
>> [hidden email]
>>
>>
>>
>>
>>
>>
>> --
>> This list is a free service of LassoSoft: http://www.LassoSoft.com/
>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>> Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>>
>
>
>
> --
> Mvh
> Johan Sölve
> ____________________________________
> Montania System AB
> Halmstad Stockholm Malmö
> http://www.montania.se
>
> Johan Sölve
> Mobil +46 709-51 55 70
> [hidden email]
>
> Kristinebergsvägen 17, S-302 41 Halmstad, Sweden
> Telefon +46 35-136800 | Fax +46 35-136801
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
 
--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Bil Corry-3
In reply to this post by Viaduct Productions
Viaduct Productions wrote on 8/20/2008 4:34 AM:
> Trying to use the full LIMIT syntax (LIMIT (offset,
> found_count_restriction)) while not using the second is confusing.

If you decide to roll your own, here's the formula for LIMIT to retrieve a specific page:

        <http://www.lassotech.com/SQL_Rows_By_Page_Number>


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Bil Corry-3
In reply to this post by Viaduct Productions
Viaduct Productions wrote on 8/20/2008 8:33 AM:
> Why would found_count not work with sql queries?

When you specify -maxrecords, Lasso finds ALL matching records, and only passes along the number you specify.  So if your query finds 1000 records with -maxrecords=10, then MySQL sends 1000 records to Lasso and Lasso gives the first 10 to the inline and sets the found_count = 1000 (the number it received).  The disadvantage of this method is it means you're transferring a lot of unnecessary data from MySQL to Lasso.  Imagine if you have a million rows and you do a -findall with -maxrecords=1, that means you're transferring 999,999 unnecessary records.

With -sql inlines specifying LIMIT (or using the -uselimit in a classic inline), MySQL instead only sends the subset of records.  So using the example above, if you -findall with -uselimit=1, then only 1 record gets transferred to Lasso instead of 1 million records.  But since Lasso received 1 record, it sets the found_count to 1 record.  But the query would really find 1 million records if LIMIT hadn't been used.

That's why the extra work to discover the "real" found_count when using LIMIT or -uselimit.


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Johan Solve
On Wed, Aug 20, 2008 at 6:19 PM, Bil Corry <[hidden email]> wrote:
> That's why the extra work to discover the "real" found_count when using
> LIMIT or -uselimit.

But do note that lasso inlines with -uselimit can still return a
correct found_count in Lasso 8.5 and later.


--
Mvh
Johan Sölve
____________________________________
Montania System AB
Halmstad Stockholm Malmö
http://www.montania.se

Johan Sölve
Mobil +46 709-51 55 70
[hidden email]

Kristinebergsvägen 17, S-302 41 Halmstad, Sweden
Telefon +46 35-136800 | Fax +46 35-136801

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Viaduct Productions
In reply to this post by Bil Corry-3
Did roll my own, but she wasn't working, and time became a factor.


On Aug 20, 2008, at 12:07 PM, Bil Corry wrote:

> If you decide to roll your own, here's the formula for LIMIT to  
> retrieve a specific page:
>
> <http://www.lassotech.com/SQL_Rows_By_Page_Number>


Rich in Toronto
...now go get on your bike


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Results Navigation...another look

Viaduct Productions
In reply to this post by Bil Corry-3
I set -maxrecords = 'all' in my dbconn, but Jason's tags required I  
take that out, because the maxrecords_value became -1 using that,  
which blew out his tags.


On Aug 20, 2008, at 12:19 PM, Bil Corry wrote:

> When you specify -maxrecords, Lasso finds ALL matching records, and  
> only passes along the number you specify.  So if your query finds  
> 1000 records with -maxrecords=10, then MySQL sends 1000 records to  
> Lasso and Lasso gives the first 10 to the inline and sets the  
> found_count = 1000 (the number it received).  The disadvantage of  
> this method is it means you're transferring a lot of unnecessary  
> data from MySQL to Lasso.  Imagine if you have a million rows and  
> you do a -findall with -maxrecords=1, that means you're  
> transferring 999,999 unnecessary records.
>
> With -sql inlines specifying LIMIT (or using the -uselimit in a  
> classic inline), MySQL instead only sends the subset of records.  
> So using the example above, if you -findall with -uselimit=1, then  
> only 1 record gets transferred to Lasso instead of 1 million  
> records.  But since Lasso received 1 record, it sets the  
> found_count to 1 record.  But the query would really find 1 million  
> records if LIMIT hadn't been used.
>
> That's why the extra work to discover the "real" found_count when  
> using LIMIT or -uselimit.


Rich in Toronto
...now go get on your bike


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

12