on 11-25-2008 9:38 AM
Hello,
I am using Java API to call matching strategy in MDM. The version is 5.5.63.80.
The class I use is: ExecuteMatchingStrategyForNewRecordValuesCommand
After successfully .execute(), I also get task ID by .getMatchingTaskId()
Problem happens when retriving matching result. There are two functions to do this.
RetrieveMatchedRecordsCommand
RetrieveMatchingResultCommand
I got error message "invalid parameter" for both of them.
For either function, I need to set source.
setSource(RecordId[] recordIds)
setSource(Search search)
However, the source is external source records. It should not have RecordID.
I tried to create a Search instance without any constrain. Same error happens.
Anyone has experience on ExecuteMatchingStrategyForNewRecordValuesCommand???
Many Thanks.
Dale
Hi Dale,
your approach seems to be in right direction except with few changes;
1) since you have number of records from source, no need to go for RetrieveMatchedRecordsCommand
because using this command you are allowed to set only one record.
So
suitable approach is to use RetrieveMatchingResultCommand
2) the following all four methods you need to use as mandatory;
- setMatchingTaskId(MatchingTaskId matchingTaskId)
- setResultDefinition(ResultDefinition resultDefinition)
- setSource(RecordId[] recordIds)
- setSource(Search search)
I guess you missed ResultDefinition;
set all the above methods;
as you are getting Records from source, get the RecordId from each and every Record and put them in array and finally pass it to setSource Method;
you can get recordId by using record.getId() method;
if you need any furthur help , please let me know;
Regards
Rajasekhar K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajasekhar
Thanks for your quick response.
My case is:
The source data is stored in an excel file.
Yes, I have many source records in the excel. But each time I call the matching strategy, I only select one record from the excel and match it with a resultset from MDM(by a certain search constrain). and loop until the last row in the excel.
As I guess, the record will have a RecordID only after it's created in the repository. Coz my source data will not be in the repository. They will not have RecordID. Is it correct?
Another question is how you construct a Record[]?
By using RecordFactory, you can only create a single empty Record NOT a record array(). When setSource(Record[] records) for ExecuteMatchingStrategyForNewRecordValuesCommand,
a Record[] is required.
My way is to retrieve a single record from repository and replace the value of each field. Can this be the reason for the error when retriving matching result?
Thank you.
Dale
The only way to find/match the record is by using RecordId;
Every Record will have unique Id i.e RecordId;
1 ) I dont know how your excel sheet has the records;
it is better to store recordId' s in excel sheet; and I think that is the only way by which you can
match the records;
2) for your question, how to create Record[] , use the following approach.
thing that u have a Record (com.sap.mdm.data.Record)
in the above scenario :-
Object [] sourceRecords = get source records here ; // this logic you need write some util function to retrieve all Excel records and put into Object[] or directly Record[] array
Record[] records = new Record[sourceRecords.length] ; // specify number of source records as length
for( int rec = 0;rec< sourceRecords .length; rec++ ) {
records [ rec ] = sourceRecords [rec];
}
3) if you really need to match one record at a time picking up from sheet , u can use RetrieveMatchedRecordsCommand else better not to use it as it hits performance making calls again and again;
Regards
Rajasekhar k
Hi Dale,
after looking into your new problem at your new thread, I came to understand ,you need to use RetrieveMatchedRecordsCommand becase of API limitation ; using RetrieveMatchingResultCommand getMatchingResults() method is not working, it retunrs null always though u have records there;
so use RetrieveMatchedRecordsCommand as I mentioned in your new Thread;
I hope that will help you ;
if still need any help , let me know;
regards
Rajasekhar K
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.