Skip to Content
0
Former Member
Jul 05, 2007 at 04:55 AM

Table filter

24 Views

Hi, I am creating a table filter on two columns .I have defined a onFilter action and bind it to the onFilter event of Table . I also defined two attributes in a Filter node and bind it to table columns filtervalue properties. Then written following code:

[code]

try {

IPrivateUserreportView.IReportTableNode objReportTablenode =

wdContext.nodeReportTable();

IPrivateUserreportView.IFilterObjNodeNode objFilterNode =

wdContext.nodeFilterObjNode();

IPrivateUserreportView.IFilterObjNodeElement objFilterElement = null;

String strfilterName = objFilterElement.getStr_Filter_ByObjName();

String strFilterDate = objFilterElement.getStrFilter_ByDate();

if ((strfilterName != null) && (strFilterDate == null)) {

wdComponentAPI.getMessageManager().reportSuccess(

"filteraction takesplace");

if (strFilterDate.equals("*"))

{

onActionShowReport(wdEvent);

}

StrfilterName =mReplace(strfilterName, "", "([a-zA-Z0-9_$ ])");

for (int j = 0; j < objReportTablenode.size(); j++)

{

String value =(String) wdContext.nodeReportTable().getElementAt( j).getAttributeValue("CUSTOM");

try {if (Pattern.matches( strfilterName.toUpperCase(),

value.toUpperCase())) { ++j;

} else { wdContext.nodeReportTable().removeElement(

wdContext.nodeReportTable().getElementAt(j));

}

} catch (RuntimeException e) { // TODO Auto-generated catch block

e.printStackTrace();

}

}

}

} catch (RuntimeException e) {

// TODO Auto-generated catch block

// e.printStackTrace();

wdComponentAPI.getMessageManager().reportException(

"on action filter" + e,

true);

}

[/code]

[code]

public java.lang.String mReplace(

java.lang.String strSource,

java.lang.String strPattern,

java.lang.String strReplace) {

//@@begin mReplace()

if (strSource != null) {

final int len = strPattern.length();

StringBuffer strBuff = new StringBuffer();

int found = -1;

int start = 0;

if (strReplace.equals("
$")) {

strReplace = strReplace.substring(0);

}

while ((found = strSource.indexOf(strPattern, start)) != -1) {

strBuff.append(strSource.substring(start, found));

strBuff.append(strReplace);

start = found + len;

}

strBuff.append(strSource.substring(start));

return strBuff.toString();

} else {

return "";

}

[/code]

I am getting Illegal argument exception while executing Filter action

Pls suggest the cause of error.