cancel
Showing results for 
Search instead for 
Did you mean: 

Search a field for one or more Values

Former Member
0 Kudos

Hi all,

I am using MDM.java API. The requirement is that the user will input more than one values separated by comma eg : AAA,BBB. The output will be the Search Results for AAA and BBB from MDM. Currently the application works fine if the user enters one value for search. How to approach the problem.

Points guaranteed!!!!

Regards

Avik

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank You all

Former Member
0 Kudos

Hello Avik,

You can use the StringTokenizer Class for solving this problem


String sre =  "aaa,bbb,ccc";
StringTokenizer st = new StringTokenizer( sre, ",");
  while( st.hasMoreTokens())
   {
   	wdComponentAPI.getMessageManager().reportSuccess( st.nextToken());
   }

This will get you the strings that are separated by the comma and you can perform the search accordingly

Regards

Vinod V

*

Former Member
0 Kudos

Hi Vinod.

I am trying to fetch the data from MDM. The SearchString to be entered by user is "String1,String2".

With reference to blog :

/people/andreas.seifried/blog/2006/03/26/performing-free-form-searches-with-mdm-java-api

I have tried the following. But this doesn't seem to work. Please help.


public void addSearchCriteriaWithComma(
		FreeFormTableParameter fftp,
		String fieldname,
		String value,
		int searchTypeSign) {
		if (value != null) {
			FreeFormParameterField searchField =
				fftp.GetFields().New(
					fieldname,
					FreeFormParameterField.SEARCH_OPERATOR_OR);
			StringTokenizer valueToken = new StringTokenizer(value,",");
			//			StringTokenizer valueToken = new StringTokenizer("7000318,7000324", ",");
			while (valueToken.hasMoreTokens()) {
				value = valueToken.nextToken();
				searchField.GetFreeForm().NewString(value, searchTypeSign);
			}

		}
	}

Former Member
0 Kudos

Hi avik,

Whats the result that its giving when you implement the code? One way that i feels to solve is by using thread for each string that are generated in while loop, there you have to pass the search string that is been generated and get the result..

I havn't tried threads in WebDynpro. Please try this way, as while loop won't be a matter when you use threads in this case.

Regards

Vinod V

*

Former Member
0 Kudos

The result for this is it returns 0 Search Results MDM. As far as threads are concerned. I don't know how to use them. Still early days in Web Dynpro

Former Member
0 Kudos

Thanks Vinod. I got it solved after some modifications.