It's all about the answers!

Ask a question

[PUB] Does RPE Studio supports ArrayList, HashMap (Collections)


Chandan M B (11314184) | asked Aug 02 '21, 1:07 a.m.
edited Aug 02 '21, 1:08 a.m.

 Hello Team,


 I have a use case probably it can be solved in different way. 
  • Does RPE Studio supports List, Map ... ?

 Use Case :
 
 Assume for a requirement , it can be linked to multiple test cases using validated by Link. But while printing I have to print in a different way. 
My starting point of retrieving / printing is Doors Next Generation 
  • Test Case ID     Test Summary      Requirement ID      Requirement Summary 
Could you please support if any alternate solution?

Regards,
Chandan

Accepted answer


permanent link
Subramanya Prasad Pilar (4.6k16) | answered Aug 19 '21, 12:03 p.m.
Yes. Most of the standard Java classes can be used inside the java script. The following will work fine in RPE template:


//ElementsList and TypesMap are template variable
if (ElementsList == null || ElementsList == ""){
    ElementsList = new java.util.ArrayList();
}

TypesMap = new java.util.HashMap();
TypesMap.put("Type1", new java.util.ArrayList());
var val = TypesMap.get("Type1");

Chandan M B selected this answer as the correct answer

Comments
Chandan M B commented Aug 19 '21, 11:54 p.m.

Thanks Prasad.

From which RPE version it is supported ?
Could you please confirm that ?


Subramanya Prasad Pilar commented Aug 20 '21, 1:32 a.m. | edited Aug 20 '21, 1:53 a.m.

I have tried it in 7.0.2. You can try in RPE 6.0.6.1 as well.

2 other answers



permanent link
Bartosz Chrabski (3.4k22949) | answered Aug 02 '21, 2:40 a.m.
edited Aug 02 '21, 3:25 a.m.

 You can use array of objects.


var obj = new Object();
obj['name'] = 'Tom';
obj['surname'] = 'Smith';
var array = [];
array.push(obj);


permanent link
Chidambaram L (23424390) | answered Aug 19 '21, 2:51 a.m.

javascript des not support ArrayList or HashMap.

json data structure is an option.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.