It's all about the answers!

Ask a question

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


Chandan M B (1133265) | 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.6k14) | 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.3k12648) | 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 (2343770) | 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.