cancel
Showing results for 
Search instead for 
Did you mean: 

Can any body tell how to support * operator in filtering a table in webdynp

venkatakalyan_karanam
Active Contributor
0 Kudos

how can you support * symbol while filtering ,

At present i written the code according to the blog filtering the table, in that the method used is String.matches(anotherString). This supports .* filter criteria not only .Please anybody help me that user only enters " text " instead of " text . * "

Please give the reply ASAP.I need urgent requirement.Help me with code snippet.

My mail ID is venkatakalyan.k@gmail.com

Accepted Solutions (1)

Accepted Solutions (1)

PBA95
Explorer
0 Kudos

Hi,

You can do like this:

String filterXPTO = wdContext.currentFilterElement().getXPTOString();

filterXPTO = "." + filterXPTO.trim().toUpperCase() + ".";

and then call a generic function that you can put in the Controller:

wdThis.wdGetController().FilterNodeFilter(filterXPTO,"XPTO");

public void FilterNodeFilter( java.lang.String strFilter, java.lang.String strField )

{

//@@begin FilterNodeFilter()

IResumoNode myValues = wdContext.nodeToFilter();

String strValue ="";

for (int i =myValues.size()-1; i >=0; i--) {

strValue = ((String) myValues.getElementAt(i).getAttributeValue(strField)).toUpperCase();

if (!strValue.matches(strFilter))

wdContext. nodeToFilter ().removeElement(wdContext. nodeToFilter ().getToFilterElementAt(i));

}

//@@end

}

In this case the result is the same if the user enters “text* " or just “text”

Best Regards,

Pedro Bento

Answers (3)

Answers (3)

venkatakalyan_karanam
Active Contributor
0 Kudos

Hi all

Thank you very much for giving the idea ,I resolved the problem Thanks a lot and wish you a happy new year 07.

regards

venkat kalyan

Former Member
0 Kudos

Hi:

try:

/people/peter.vignet/blog/2007/01/03/generic-web-dynpro-java-table-filter

regards

Former Member
0 Kudos

Hi Venkat,

Here is one another approach

Do the following.

1] Create the following method

public java.lang.String getFormatData( java.lang.String source )//CONVERT => .

{

String result="";

int l=source.length();

for(int i=0;i<l;i++)

{

char a=source.charAt(i);

if(a=='*')

{

result=result+".*";

}

else

{

result=result+a;

}

}

return result;

}

2] In onFilter action,

String a=<get filter data that contain *>;

String keywithdot&asterik=wdThis.getFormatData(a);

3] Use 'keywithdot&asterik' variable in matches() method

Thanks

Fahad Hamsa

venkatakalyan_karanam
Active Contributor
0 Kudos

Hi bento

Thanks for giving the reply finally i got the solution thank you once again for giving me the idea

Thanks and regards

venkat