cancel
Showing results for 
Search instead for 
Did you mean: 

Searching on Qualified Table

michael_pang4
Active Participant
0 Kudos

Hi,

I spent hours reading the forum yesterday and I'm still unsure how to achieve what I want to do.

I find the MDM Java API extremely complex (I hope I am not the only one).

I want to be able to search on main table records based on qualified link values.

Main table "Products", has field "AFS_Season" qualified link to a qualified table "AFS_Season".

"Season" contains fields "Season", "Market", "Theme".

There could be multiple links to this qualified table.

All I want is get all records in Products where it has link to records of Themes = T1 OR T2.

Something as simple as that is not easily achievable.



			Search search = new Search(c_Products);
			search.SetSearchType(Search.GlobalOrSearchCombinationType);
			
			FreeFormTableParameter fftp =
				new FreeFormTableParameter("AFS_Season");

			FreeFormParameterField ffpf =
				fftp.GetFields().New(
					"Theme",
					FreeFormParameterField.SEARCH_OPERATOR_OR);
			ffpf.Add(
				new StringParameter(
					"T1",
					FreeFormParameter.SoundsLikeSearchType));
			ffpf.Add(
				new StringParameter(
					"T2",
					FreeFormParameter.SoundsLikeSearchType));

			search.Add(fftp);

			rs = catalog.GetResultSet(search, rsd, c_Material_Number, true, 0);

This code doesn't work.

If I only have one value and not both it works.

PS. I tried separating it into two FreeFormParameterField, or two FreeFormTableParameter, but both doesn't work.

What is somethign so simple so complex?

Please help.

Cheers

Michael.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Michael,

I'm assuming here that, "Theme" is YES quialifier for the qualified table.

Try specifying the FreeFormParameter as below,


FreeFormParameterField ffpfName1 = fftpNames.GetFields().New("Theme",
                       FreeFormParameterField.SEARCH_OPERATOR_OR);


ffpfName1.GetFreeForm().NewString("T1", FreeFormParameter.SubstringSearchType);


ffpfName1.GetFreeForm().NewString("T2", FreeFormParameter.SubstringSearchType);

There is an amazing blog on Free Form Search, which you can find <a href="http:///people/andreas.seifried/blog/2006/03/26/performing-free-form-searches-with-mdm-java-api

Hope this helps.

Regards,

Mausam

michael_pang4
Active Participant
0 Kudos

Thanks.

Didn't work. Substring just the same.

I've read that blog before already. It works when searching on a field in the main table using the OR option. However if you want an OR statement in the QL table, it's not possible. (That's what I am trying to find out)

Cheers

Michael

Former Member
0 Kudos

Hi Michael,

Can you please confirm the search that you are trying to do, can be done through Data Manager "Free Form Search" ( You can find it on the bottom left with the small arrow mark ). If that is possible then and then you can go ahead with Java APIs.

Logically, with whatever fields of Qualified Table you are planning to search, they must be "YES" qualifiers. This ensures these fields are part of Main Table rather than Qualified.

Thanks,

Mausam

michael_pang4
Active Participant
0 Kudos

Hi,

We've just tried doing the following and it works via Data manager:

Search Expression = AFS_Season.Theme = 01 or AFS_Season.Theme = 02

michael_pang4
Active Participant
0 Kudos

Hi, Just to add, i've now tried through data manager with the query mentioned above.

I tried to do the same in Java API and it is NOT WORKING.

Can any experts out there help me with this very simple search query with an OR condition?


			// For season, themes, and market, we have to look in AFS_Season table
			FreeFormTableParameter afs_season_fftp =
				new FreeFormTableParameter(c_AFS_Season);

			// For season, themes, and market, we have to look in AFS_Season table
			FreeFormParameterField searchField =
			afs_season_fftp.GetFields().New(c_Theme, FreeFormParameterField.SEARCH_OPERATOR_OR);
			searchField.GetFreeForm().NewString("01", FreeFormParameter.EqualToSearchType);
			searchField.GetFreeForm().NewString("02", FreeFormParameter.EqualToSearchType);


Answers (0)