It's all about the answers!

Ask a question

Return value of RM.Client.setSelection(...)


Christian Opitz (63412) | asked Jul 04 '19, 9:51 a.m.
Hello all!

is there a way to find out if RM.Client.setSelection(...) has really selected the artifacts desired?
Background: the function does not select anything when the artifacts are currently not displayed (e.g. hidden hierarchy level, filtered, etc).
The function seems to always return 'undefined'

Thank you!

One answer



permanent link
Davyd Norris (2.9k217) | answered Jul 07 '19, 7:33 p.m.
There are two ways to check:
 - the function returns false of any of the artefacts cannot be selected for any reason, and doesn't modify the current selection, so if you have nothing selected to start with then nothing will be selected afterwards
 - the function triggers the ARTIFACT_SELECTED RMEvent if successful

So firstly you can check for a return of false, but you can also use the RMEvent.subscribe() function to register a callback to see what's been selected.



Comments
Christian Opitz commented Jul 08 '19, 5:23 a.m. | edited Jul 08 '19, 5:34 a.m.
Thanks for your feedback. I expected, that there is a return value. However, I don't get a return value when calling setSelection(...), but always 'undefined'

var retValu = RM.Client.setSelection(row.ref);
console.log (retValu);

I am running 6.0.6 iFix009, is there any issue known, or is it me not doing it right?

Davyd Norris commented Jul 08 '19, 7:34 p.m.
In JavaScript, an undefined is considered to be false (or falsy, to be precise) but I would have expected it to return an actual false.

Can you post your full code snippet? I would like to see where row.ref is defined and how it's being set.

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.