on 12-20-2006 11:07 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.