cancel
Showing results for 
Search instead for 
Did you mean: 

Table filter

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

thanks

Former Member
0 Kudos

hi friend,

>> Pl check the cordinality of the FilterNote , it should be 1-1

>> set table node cordinality as 0-N because ur filtering result may zero or more

Former Member
0 Kudos

Hi sharma,

u r checking

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

but i think u have to check the below condition

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

Former Member
0 Kudos

Hi

IPrivateUserreportView.IFilterObjNodeElement objFilterElement = null;

Here you are assigning a null value for the element objFilterElement

String strfilterName = objFilterElement.getStr_Filter_ByObjName();

String strFilterDate = objFilterElement.getStrFilter_ByDate();

It is not possible to access the values Str_Filter_ByObjName and StrFilter_ByDate using null value.

I think thats the reason you have ended up in an error