Hi,
The following is the method used to perform the delete action.
//[[SPIDER_EVENT<btnDelete_onWebEvent>
public int btnDelete_onWebEvent(CSpWebEvent event)
{
try
{
try
{
_context = CSpider.getUserSessionObject("ContextName").stringValue() ;
}
catch(Exception ex)
{
showError("Internal Error.", "Failed to get the Session Object
ContextName", new CSpString(this.getName()));
return STOP;
}
String tableName = null, fieldName = null ;
if( _context.equals("WorkDept") )
{
tableName = "t_workdept" ;
fieldName = "RID" ;
}
else if( _context.equals("MWO") )
{
tableName = "t_mwo" ;
fieldName = "MWONUMBER" ;
}
else if( _context.equals("DeptRate") )
{
tableName = "t_dept_rate" ;
fieldName = "DEPARTMENT" ;
}
int totalNumOfRows = getDisplayFieldValue("hbNumOfRows").intValue() ;
String toDelete = null, tempVal = null ;
CSpValue ifChecked ;
for( int i = 0 ; i < totalNumOfRows ; i++ )
{
if( i == 0 )
{
ifChecked = CSpider.getWebVar("cbDelete") ;
if( ifChecked != null )
{
if( ifChecked.stringValue().equals("T") )
{
tempVal = CSpider.getWebVar("hbID").stringValue() ;
vWorkDept.addElement(tempVal);
toDelete = "'" + tempVal + "'" ;
}
}
}
else
{
ifChecked = CSpider.getWebVar( "cbDelete[" + i + "]" ) ;
if( ifChecked != null )
{
if( ifChecked.stringValue().equals("T") )
{
tempVal = CSpider.getWebVar("hbID[" + i + "]").stringValue() ;
vWorkDept.addElement(tempVal);
if( toDelete != null )
toDelete = toDelete + ", '" + tempVal + "'" ;
else
toDelete = "'" + tempVal + "'" ;
}
}
}
}
int command = CSpDataObject.executeImmediate("dsJCS", "delete " + tableName
+ " where " + fieldName + " in( " + toDelete + " )", jobcard.MAX_ROWS
).getResultStatus().getErrorCode() ;
if (command == CSpDataObject.SUCCESS)
{
for (int i = 0; i < vWorkDept.size(); i++)
{
Object obj = vWorkDept.elementAt(i);
if (obj instanceof String)
ActionLog("Deleted", sFunction, obj.toString(), "XXX");
}
}
return(load());
}
catch(Exception ex)
{
showError("Unknown Error.", "Failed to perform the Delete Action.", new
CSpString(this.getName()));
return STOP;
}
}
//]]SPIDER_EVENT<btnDelete_onWebEvent>
Regards,
A.Velmurugan.
Curt Springer wrote:
> Send us a code snippet so we can see how you're carrying out the delete.
>
> -- Curt Springer, Team ND
>
> At 09:18 AM 8/2/99 +0530, A.Velmurugan wrote:
> >Hi,
> > I have a CSpRepeated object which has got one check box, one Href
> >and some static text fields. The check box is being used to identify the
> >
> >records to be deleted. If i select rows whoose row index less that 1000,
> >
> >i am able to delete them. But, if the row index is greater or equal to
> >1000, i am not able to delete. The Netdynamics log message is
> >"CSpUtil:c:933344485687:w:933344486277:putIndexedElement: Too many
> >indexed values (more than 1000 ?!?)". Could any body helf in this
> >regard.
> >Thanks in advance,
> >A.Velmurugan.
> >
> >
> >
> >_________________________________________________________________________
> >
> >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]
_________________________________________________________________________
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]