First off, you don't need to need to store the row index in a session object.  You 
could just store it in an instance
variable.  But that's a side issue.

You want to suppress duplicate rows, so that implies that you need to check a value 
(at least one) in the current row against
a value in the previous row.  Something like this:

public int this_onBeforeRowDisplayEvent()
//assuming that if primary key value is same, then row is same as previous
{
int rowindex = event.getRowIndex();
if( rowindex >= dataobject.getNumRows())
    {
    return STOP;
    }//if..
String primarykeyvalue = dataobject.getValue(rowindex, 
"primarykeycolumnname").toString();
if ((rowindex > 0) &&(primarykeyvalue.equals(_primarykeyvalue)))
    {
    //current row is dupe of previous
    return SKIP;
    }//if
    else
    {
    _primarykeyvalue = primarykeyvalue;
    return PROCEED;
    }//else
}//this_onBeforeRowDisplayEvent

private String _primarykeyvalue;    //will hold primary key value of last unique row 
that was displayed.

-- Curt Springer, Team ND

Rimma a �crit:

> Hello my Forum Pals!
>
> In my application, I have the Repeated Object  which has 4 rows displayed from the
> database.  However, the first row is often repeated and therefore, when it repeats 
>itself,
> I want to make sure that it's skipped.
>
> The way I wrote my code right now, it displays the first row in the first record and 
>doesn't
> display any following first row.  I have to mention this first row has its own table,
> "Businesses", however, in that particular query, it's taken from another table
> "textArticles"  (just in case it helps).
>
> Here's the code that I'm using.  Does anybody have any suggestions?  What should I
> change?
>
> //[[SPIDER_EVENT<this_onBeforeDisplayEvent>
>         public int this_onBeforeDisplayEvent(CSpDisplayEvent event)
>         {
>
>                 CSpValue date = CSpider.getUserSessionObject("sesDate");
>
>                 CSpSelect doViewResults = (CSpSelect) CSpider.getDataObject 
>("doViewResults");
>                 doViewResults.clearDynamicCriteria ();
>                 doViewResults.addDynamicCriterion ("textArticles_Date", 
>CSpCriteriaSQLObject.EQUAL_TO_STR_OPERATOR, date);
>                 doViewResults.execute ();
>
>                 return (PROCEED);
>         }
>         //]]SPIDER_EVENT<this_onBeforeDisplayEvent>
> //[[SPIDER_EVENT<Repeated1_onBeforeRowDisplayEvent>
>         public int Repeated1_onBeforeRowDisplayEvent(CSpDataDrivenVisualEvent event)
>         {
>                 CSpider.putUserSessionObject("sesRowIndex", (CSpValue) new 
>CSpInteger(event.getRowIndex()));
>                 return (PROCEED);
>         }
>         //]]SPIDER_EVENT<Repeated1_onBeforeRowDisplayEvent>
>
>         //[[SPIDER_EVENT<cbBusinesses_onBeforeDisplayEvent>
>         public int cbBusinesses_onBeforeDisplayEvent(CSpDisplayEvent event)
>         {
>                 if (((CSpInteger) 
>CSpider.getUserSessionObject("sesRowIndex")).intValue() == 0) {
>                         return (PROCEED);
>                 }
>                 else {
>                         return (SKIP);
>                 }
>         }
>         //]]SPIDER_EVENT<cbBusinesses_onBeforeDisplayEvent>
>
> Thanks a lot in advance,
> Rimma
>
> _________________________________________________________________________
>
> For help in using, subscribing, and unsubscribing to the discussion
> forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>
> For dire need help, email: [EMAIL PROTECTED]



_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to