on 01-21-2008 10:15 PM
Hi,
I am using MDM Java API to display a numeric value attribute, the API that i am using is
MeasurementManager.GetMeasurementManager().GetString(15, 1,1002,1,false,-1);
Invalid measurement id 1002. it is custom measurement ( decibels), so it is generated automatically.
could you please let me know if i am using wrong API or is there any other way that I have to retrieve those.
any help is appreciated?
Thanks
RKR
Edited by: RKR on Jan 23, 2008 4:39 PM
This is for the MDM Java API 1, correct? You should use the CatalogData.GetMeasurements() instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ALL,
firstly, I would like to thank you for your help regarding this.
As you might have noticed that I am using old API in my applicaiton. I just have this problem with measurements.
@Nick: your solution catalog.getMeasurement() also gives an instance of MeasurementManager which I am already using in my application. it is only failing for custom measurements that aqre client specific.
did anyone use measurement api for custom measurements with the old api?
please help
Thanks
If you do a
new MeasurementManager()
, this instance will not contain any of the user-defined measurements. It will only contain the built-in measurements. Retrieving the instance from
CatalogData.GetMeasurement
will contain both the user-defined measurements and the built-in measurements.
Assuming you're are using the instance from
CatalogData.GetMeasurement
, what was the error you're having? Did you define the measurements and units correctly in the DBMS table?
Nick,
Thanks for your quick reply. I defined one custom measurement correctly in UoM manager, i.e. for decibels and when i view in datamanager it is displayed correctly.
but when i use the measurement api as said in my first post, I get the following error, " Invalid measurement id 1002". 1002 is generated automatically when I created "decibels".
but as you said, I will use the catalogData.getMeasurementManager.GetString() with the same paramters and see if it brings up. I dont have access to the system right now. i will let you know once i test that.
could you please also help me out with the thread that i opened, i.e. regarding the MDM4j support getting deprecated with the sp06. would this application break?
Thanks
Hmm.. unfortunately getting the same error... any other clues..
Code:
String val1 = catalog.GetMeasurements().GetString(aex.GetAttributeValueExAt(k).GetCharacteristics().GetAttributeValueAt(0).GetValue(),aex.GetAttributeValueExAt(k).GetCharacteristics().GetAttributeValueAt(0).GetUnitID(),aex.GetAttributeValueExAt(k).GetAttributeInfo().GetDimensionID(),aex.GetAttributeValueExAt(k).GetAttributeInfo().GetDecimalPlaces(),false,-1);
Printing out the values:
10.0 101 76 0
exception:
Invalid measurement id 76 and/or source unit id 101
Thanks
I downloaded the repository. The following code works fine.
String msg;
msg = catalog.GetMeasurements().GetString(15, 1,1002,1,false,-1);
System.out.println(msg);
msg = catalog.GetMeasurements().GetString(10.0, 101, 76, 0,false,-1);
System.out.println(msg);
Here's the output:
15.0 dB
10 dBTest
Is your repository setup as a master-slave configuration?
As far as I can tell, user-defined dimensions are not propagated to the slave repository during synchronization. I do believe user-defined dimensions are propagated to the slave repository when you create a new slave.
Did you test using the slave repository or the master repository?
If you can do a quick test connecting to the master repository, that will pretty much confirms it.
Hi Nick,
I just wanted to know if there is something wrong with my code in using the catalog object... here is how i create a connection to my MDM system and use the catalog object.
Context ctx = new InitialCOntext();
IConnectionFactory connectionFactory = (IConnectionFactory) ctx.lookup("deployedAdapters/MDM Factory/ shareable/MDM Factory");
ICOnnectionSpec spec = connectionFactory.getConnectionSpec();
spec.setPropertyValue("Username", "rkr");
spec.setProeprtyValue("Password", "rkr1");
spec.setPropertyValue("Server", "<server name>");
spec.setPropertyValue("Port", "<server port>");
spec.setPropertyValue("Repository lang", "<rep lang>");
connection = connectionFactory.getConnectionEx(spec);
INative nativeInterface = connection.retrieveNative();
CatalogData catalog = (CatalogData) nativeInterface.getNative(CatalogData.class.getName());
// I am able to retrieve the catalog object and different values from the catalog and it works fine
String val1= catalog.GetMeasurements().GetString(10.0, 101, 76, 0,false,-1);
Thanks
I didn't obtain the CatalogData instance from
nativeInterface.getNative(CatalogData.class.getName())
.
Instead my test code obtain the CatalogData by doing something like this:
catalog = new CatalogData();
catalog.Login(...);
It shouldn't matter how you obtain the CatalogData instance as long as that instance is correctly connected to the repository.
Hi,
Following blogs may help you, it is related to JAVA API 2:
MDM Java API 2 part I
/people/tobias.grunow/blog/2007/12/16/mdm-java-api-2-an-introductive-series-part-i
MDM Java API 2 part II
/people/tobias.grunow/blog/2007/12/18/mdm-java-api-2-an-introductive-series-part-ii
MDM Java API 2 part III
/people/tobias.grunow/blog/2007/12/27/mdm-java-api-2-an-introductive-series-part-iii
It may help you.
Reward points if found helpful.
Regards
Swapnil.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to use RetrieveBlobCommand to get the actual blob for images, pdfs, text blocks.
RetrieveBlobCommand cmd = new RetrieveBlobCommand(repository.getConnection());
cmd.setSession(repository.getAuthenticatedUserSession().getSession());
cmd.setTableId(tableID);
cmd.setRecordId(recordID);
cmd.setImageVariantId(variantId);
try {
cmd.execute();
} catch (CommandException e) {
e.printStackTrace();
}
MultiregionValue multiRegionValue = (MultiregionValue)cmd.getBlob();
*********************************************************
If you want to just get the information about the blob, then just cast from the Record (records from the appropriate table - Images, PDFs, etc) to the appropriate blob (TextBlobRecord, ImageBlobRecord, etc):
Record record = blobRecords[<i>];
// Casting done to get the properties we need
BlobRecord blob = (BlobRecord) record;
ImageBlobRecord imageBlob = (ImageBlobRecord) blob;
************************************************************
For attributes you need to use RetrieveAttributeCommand to get the attributes and then use the appropriate classes based on the type (TextAttributeProperties for a Text attribute, etc).
Something like:
RetrieveAttributeCommand retAtt =
new RetrieveAttributeCommand(conn);
retAtt.setAttributeId(id);
retAtt.setSession(session);
retAtt.setTaxonomyTableId(new TableId("T5"));
retAtt.execute();
TextAttributeProperties props =
(TextAttributeProperties) retAtt.getAttribute();
System.out.println("Attribute Name = " + props.getName());
TextAttributeValueProperties[] val =
props.getTextAttributeValues();
Then you need to check the Id's to see if you have a match:
if (txtVal.getId().getIdValue()== val[<i>].getId().getIdValue())
Looks like you are using Older version of Java API. Here is the link to the latest Java API [http://help.sap.com/javadocs/MDM/current/index.html|http://help.sap.com/javadocs/MDM/current/index.html]
BR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
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.