Skip to Content
1
Former Member
Jul 20, 2007 at 03:19 PM

How to get the text value of a TextAttributeValue (sub class of MdmValue)?

18 Views

Dear All,

(I am using the new apis )

I have a record


RecordId  rec = new RecordId(“R15”);

ResultDefinition rsd = def.getMainTableRSD();
//in the lets say rsd.setLoadAttributes(true);

	ResultDefinition[] supRsd = def.getSupportingRSD(conn,session);
	RetrieveRecordsByIdCommand retById = new RetrieveRecordsByIdCommand(conn);
	
	retById.addId(rid);
	//retById.setRegionalLayer()
	retById.setSession(session);
	retById.setResultDefinition(rsd);
	retById.setSupportingResultDefinitions(supRsd);
	try {
		retById.execute();
		RecordResultSet rrs = retById.getRecords();
		Record rec = rrs.getRecord(0);


And

  AttributeId[] aId = rec.getAttributes(new FieldId("F444_71152"));
    System.out.println("aId " + aId.length);
    
   
    for (int i = 0; i < aId.length; i++) {
		AttributeId id = aId<i>;
		 MdmValue val =  rec.getAttributeValue(new FieldId("F444_71152"),id);
		 System.out.println("type "+ val.getType());

This brings me to

if(val.getType() == MdmValue.Type.TEXT_ATTRIBUTE){
		 	TextAttributeValue txtval = (TextAttributeValue) val;
		 	System.out.println("TextAttribute : "+txtval);
		 	
		 }

This prints out “TA###” “TA964” .

My question is how do I get the value that is inside this record

The expected output is something like “10mm”.

Thank you in Advance