logo

New Response

« Return to the main article

You are replying to:

  1. Hi, i use the same code from this "post", and i have managed to bypass this fool limitation of 250 documents.

    I dont know if changing QueryMaxResults=XXXX; with a number bigger then 250, would let the code work properly, i mean by showing correctly the paging...

    and if somehow you dont have how to change this notes.ini variable... here is the code i´ve built for making this possible...

    little explanation of MY PROBLEM:

    i have created like a photoAlbum based on domino for one of our clients, and you can split this photos for different Categories.

    Once the user clicks one of these categories, it will show him it´s thumbnails...

    So the client has a category with more than 800 photos, and he found this bug.

    i set it up to show 12 hits per page.

    so 250 / 12 = 20,83333 = 21 pages.

    1 2 3 4 5 .... 21 Next>>

    when the user started clicking on "next>>" the results were fine, but the paging not. it couldnt go for 22, 23,24,25( i meant show the label "22" , "23" red highlighted) cause of this "incomplete" code.

    So here it is, i hope it will solve your paging problem too , maybe with a few mods.

    FIRST : At the $$SearchTemplate form , at its bottom, you might have something like this:

    </script> <tr align="center" valign="middle"> <td height="50" colspan="4" class="Linha03"><Computed Value><Computed Value><Computed Value></td> <------------------------------ </tr> <tr align="center" valign="middle"> <td height="50" colspan="4" class="Linha03">Página Atual: <Computed Value></td> </tr> </table>

    The important line is indicated with this "<------"

    as u can see, it has 3 computed values..

    the first one , is the "Previous" nav button, in my case the code is(keep this code):

    view = @ViewTitle; pageString := "<a class=Pag href=\"" + view + "?SearchView&Query=" + Query + "&start="; hitNum := @If(TotalHits > 250;250;TotalHits-1); adJust := @Integer(hitNum/12); endDate := @Text(@Adjust([01/01/1900];0;0;adJust;0;0;0);"D0S0"); numRange := @Explode(@TextToTime("01/01/1900 - " + endDate)); numList := (@TextToTime(numRange) - [01/01/1900]) / 86400; textList1 := numList+1; @If(TotalHits > 12;"<font class=\"Linha03\">Páginas de resultado: </font>" + @If(TotalHits<(Start*textList1);"<font color=\"006799\"><<</font> "+pageString + @Text(Start-12) + "&count=12&Pchave="+CurrentQuery+"\">" + "Previous" + "</a>&nbsp;&nbsp;";"");"&nbsp;")

    the second computed value, which one is responsable for generating the pages, and the one u must update the code :

    view := @ViewTitle; QUERY_STRING_DECODED := @ReplaceSubstring(QUERY_STRING_DECODED;"agent";""); vTemp := @TextToNumber( @Left(@Right(QUERY_STRING_DECODED;"&start=");"&count=") ); vPagAtual := @If(@Contains(QUERY_STRING_DECODED;"&");((vTemp-1)/12) + 1;1);

    vQueryString:=@If(@Contains(QUERY_STRING_DECODED;"&Pchave");QUERY_STRING_DECODED ;"Open&view="+baseview+"&start=1&count=12&Pchave="+currentquery);

    vTeste := "<a class = Pag href=\"getViews?"+vQueryString+"\">" + @Trim(@Text(vPagAtual)) + "</a>"; vNovoLink := "<font color=\"red\">" + @Trim(@Text(vPagAtual)) + "</font>";

    pageString := "<a class = Pag href=\"getViews?Open&view="+baseview+"&start="; hitNum := @If(TotalHits > 250;250;TotalHits-1); deslocate:= @if(start>(12*21);@Integer((start-(12*21))/12)+1;0); adJust := @Integer(hitNum/12); endDate := @Text(@Adjust([01/01/1900];0;0;adJust;0;0;0);"D0S0"); numRange := @Explode(@TextToTime("01/01/1900 - " + endDate)); numList := ((@TextToTime(numRange) - [01/01/1900]) / 86400) + deslocamento; textList1 := @Text(numList+1); textList12 := @Text(numList * 12+1); repl := pageString + @Text(Start) + "&count=12\">" + @Text(1+Start/12) + "</a>"; with := "<b>" + @Text(1+Start/12) + "</b>";

    vLinks := @Replace(pageString + textList12 + "&count=12&Pchave="+CurrentQuery+"\">"+ textList1+"</a>"; repl; with);

    vFinal := @ReplaceSubstring(vLinks;vTeste;vNovoLink);

    @If(TotalHits > 12;@Implode(vFinal ;"&nbsp;&nbsp;") ;"&nbsp;")

    here is the difference to this post´s code:

    deslocate:= @if(start>(12*21);@Integer((start-(12*21))/12)+1;0);

    numList := ((@TextToTime(numRange) - [01/01/1900]) / 86400) + deslocate;

    Can you see what i´ve thought?

    and the third computed value is ( keep its code):

    view = @ViewTitle; pageString := "<a class = Pag href=\"" + view + "?SearchView&Query=" + Query + "&start="; @If(TotalHits > 12;@If(TotalHits>=Start+hits;"&nbsp;&nbsp;" + pageString + @Text(Start+12) + "&count=12&Pchave="+CurrentQuery+"\">"+"Next" + "</a>"+"<font color=\"006799\"> >></font>";"");"&nbsp;")

    now, if you have more than 250 results, As example you have 12 hits per page.. it will work like:

    1 2 3 4 5 .... 21 Next>>

    if you click "21" and then Next>> again it will look like:

    2 3 4 5 6...... 22 Next>> 3 4 5 6 7 ..... 23 Next>> 4 5 6 7 8 ..... 24 Next>>

    I hope my post can help somebody with the same problem!!!

    voila!

    Fernando Ferrandini - Junior Lotus Developer.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: