cancel
Showing results for 
Search instead for 
Did you mean: 

record.getAttributes(fieldsMT[2]); why the result array's lenth is zero?

Former Member
0 Kudos

my code:

Record record = rlrCmd.getRecords().getRecord(0);

MainRecord mRecord = new MainRecord();

mRecord.setName(record.getFieldValue(fieldsMT[1]).toString());

//获取taxonomy类型字段的属性及值

TableId taxonomyTableId = rep.getTableId("Categories");

AttributeId[] attributeIds = record.getAttributes(fieldsMT[2]);

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I mean to say that you are trying to access the ecord at position 0 using the below command:

Record record = rlrCmd.getRecords().getRecord(0);

Please try printing the count for the records you are retrieving using below command:

wdComponentAPI.getMessageManager().reportSuccess("Record Count"+ rlrCmd.getRecords().getCount());;

Cheers,

Arafat

Former Member
0 Kudos

oh.i see,but the record is not null,rlrCmd.getRecords().getCount()==1

Former Member
0 Kudos

Hi,

While retrieving the record, you need to set a parameter to load the Attributes for a taxonomy linked to main table.

In the ResultDefinition set the following value before executing the command:

objResultDefinition.setLoadAttributes(true);

where objResultDefinition is the objct that you created for rsult definition.

Hope this helps!!

Cheers,

Arafat

Former Member
0 Kudos

oh.thank you,you are right. i do not set resultdefine.

but i have another question,hope you can help me .

i want to get attribute value.but the attribute's type is text ,when i use

record.getAttributeValue(fieldsMT[2], attributeIds<i>)

to get the value,return me is the index of the attribute value.

Former Member
0 Kudos

Hi,

you can use TextAttributeValue for that.

Cheers,

Arafat

Former Member
0 Kudos

thank you very much! under your help.i resolved the problem thank you more!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Please check the size of "record" to if the record you are trying to access is coming.

Cheers,

Arafat

Former Member
0 Kudos

hi, i can not understand you completely, can you give me a minute description?thank you!