Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Referring to a Data Collection Parameter in a Routing Script

rachel9165
Discoverer
0 Kudos

Hi, I am new to SAP ME and I am wondering if there is a way to reference a data collection parameter in a routing script. For example, I have a data collection parameter that results in either a "PASS" or "FAIL". I want to reference this results and say if the result = "FAIL", return to the previous step in the routing to be reworked. Is this possible? I know there are some pre-made scripts available but I was not able to achieve my goal after messing around with them. I keep getting an error saying it is unable to reference the data collection parameter.

5 REPLIES 5

anne-petteroe
Community Manager
Community Manager
0 Kudos

Hello Rachel,

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers, as it provides tips for preparing questions that draw responses from our members.

Feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html as well, as that will also help you when preparing questions for the community.

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage your readers to respond.

Kind regards,
Anne

steve_stubbs
Participant
0 Kudos

Hi Rachel,

The only way to examine a data collection value from within an ME Router Script is via a SQL Query against the PARAMETRIC_MEASURE table in WIP. The documentation for writing query scripts (called formula scripts in the section) is here.

Regards, Steve

0 Kudos

Thank you Steve, I will look into that!

0 Kudos

I have added in the following script:

result=getCustomItemProperty("P110_15996451_1");

if (result="FAIL")

exit(true);

else

exit (false);

where P110_15996451_1 is the parameter from the data collection that I am trying to retrieve. This parameter will always be equal to "PASS" or "FAIL". I have set the "Fail DC" routing to the code above and the "PASS DC" routing with the same code except is says if(result = "PASS")

The code does not give any errors, but when P110_15996451_1 = "FAIL" it still gives me the option of what route I want to take. The same is true when P110_15996451_1 = "PASS". Do you know why it is still giving me a choice when it should be automatically forcing one of these paths?

0 Kudos

Hi Rachel,

First thing to do is to set up ME to debug the scripts (as defined in the link above), and then add print(result); statement following the result=getCustomItemProperty("P110_15996451_1"); assignment, to see what is actually being returned from the function. If you are getting a choice when Completing the SFC, then the router script is failing somewhere. The print() statements in the script can help you identify where the script is failing.

Also, make sure router scripts are enabled in your system; see the note at the end of this section.

Regards, Steve