It's all about the answers!

Ask a question

RPE Report with user input to use multiple entries


Michael Toole (31168) | asked Jun 11 '14, 9:16 p.m.
edited Jun 11 '14, 9:17 p.m.
 I hope I can explain.
I have a rpe report that has a user input variable for the work item id from rtc.  The field works with just one id but I am needing to put in different ids and or range of ids to pull.  
Ex.
User input- 12345, 12346, 12500-12550
And the report would show just those ids.
Using rpe 1.2.1.1 and rtc 4.0.3
Thanks in advace

2 answers



permanent link
Abish Mathew Zachariah (252211) | answered Jul 25 '14, 8:15 a.m.

Hi Michael

You can use the below script to split those user inputs separated by a (,).

var str = "12345,12346,12500,"
do
{
var s=str.substring(0,str.search(','));  
str=str.substring(str.search(',')+parseInt("1"),str.length);       
console.log( "New value of str: "+s)
}
while (str.length!==0);

In RPE you can use RPE variables (external and internal) instead of actual variables in the script. You may have to use an Iteration Element in RPE to implement the above do while loop. The value to the variables can be controlled using assignments and a similar JavaScript like above.

Best Regards
Abish M Zachariah


Comments
Michael Toole commented Jul 25 '14, 8:23 a.m.

  thanks for the reply.  So i currently have an external variable called

${wi_id}
and when i publish it to RTC as a report resource, i do get the question of the variable. I put in ONE workitem and it returns the work item like it should.  Id like to be able to use that script to work with my variable so that the user can input various id's like
12354, 12346, 12340-12380

would i just replace the var str with ${wi_id}?


permanent link
June Boston (1941737) | answered Jun 12 '14, 5:14 p.m.
 Is there a reason you are having these work item IDs entered as IDs, instead of allowing the users to directly select work items?

It may work with your design to have all the IDs entered in the same box in some consistent format, such as comma separated values.  You could then use javascript to parse them into individual values and do whatever it is you're trying to do.

Comments
Michael Toole commented Jul 24 '14, 2:21 p.m.

  could you provide an example on the javascript? im a newbie so please bear with me.

Your answer


Register or to post your answer.