E9.2 One Orchestration two different outputs?

Stank1964

Well Known Member
I do appreciate the efforts and help that this forum provides. Thanks to one and all!

Now a new question…

Can a single orchestration have 2 different outputs?

Suppose I have an orchestration that contains a parameter, let’s call that variable “#columns”. The “#columns” variable can have 2 values 3 or 4. Now, let’s say the orchestration is supposed to return an array in 2 different formats based on the value of the “#columns” variable - either 3 columns or 4 columns. Can this be done with one orchestration?
 
Yep! Should be possible. You could set a 3 column json array and a 4 column json array in scripting within the orch, and then based on the input var #columns you set a single output array container to contain the proper array at manipulate output step. It's probably not the best thing for a beginner, you might want to grab some consulting hours to do it at first.
 
The only thing is that you really want to make sure that the downstream consumer of that orch API can consume the varying array size. Your API customers might not be too happy with a variable array :) I've learned people like to map to very specific addresses in your responses :)
 
Hi Dave. Thanks for the response. I think I understand what you are saying. I intend to vary the output based on the partner. One partner gets less data than the other and they control it with the parameter. So for either partner, the output is consistent.

Thanks to this forum, I am learning how I can leverage groovy to do good things. Can you provide a sample of the groovy to do this?

By the way, Nami over at the oracle help line told me that groovy will be swapped out and/or supplemented with jRuby…..
 
This is one where I think you should grab some consulting hours to do it exactly how you want. I don't have any examples I can draw from to get you an answer in under 5 mins (as I have had with other answers in here). Others might have some code they have handy though!
 
I do not-- I work fulltime for a JDE customer, but I can personally highly recommend ACBM solutions as well as innova9. They've been at this far longer, and are far better at this stuff than me. They're the ones that give the really cool presentations at conference.


 
Well, I made it WORK!!!!! Thanks for the inspiration Dave!

The form request transformation tab has to be set to "return raw output". Doing this allows you to set that output as an input to a custom groovy script. The groovy script is not set to "return raw output" or you will end with the json having extra escape characters.

Again, I do appreciate all of the posts on this forum, they were infinitely helpful , so I feel inclined to pay it back. Here is the groovy. Keep those custom groovy code snippets coming, it's our only way to survive, oracle help is less than helpful. In the end, it was quite simple. Trying to figure out what it wants me to do was the toughest thing about it.

Hopefully this post will help someone minimize the number of ORCH objects necessary to operate. A note about my use case.... In my example, I am extracting customer data and sometimes the end use of the API requires more columns or less columns, it just depends. Now, I can support one API and the code handles both situations.


import groovy.json.JsonSlurper;
import groovy.json.JsonBuilder;
import com.oracle.e1.common.OrchestrationAttributes;
import java.text.SimpleDateFormat;
HashMap<String, Object> main(OrchestrationAttributes orchAttr, HashMap inputMap)
{
HashMap<String, Object> returnMap = new HashMap<String, Object>();
// Add logic here
// String stringVal = (String)inputMap.get("inputStringVal");
// BigDecimal numVal = new BigDecimal((String)inputMap.get("inputNumVal"));
// SimpleDateFormat format = new SimpleDateFormat(orchAttr.getSimpleDateFormat());
// Date dateVal = format.parse((String)inputMap.get("inputDateVal"));

// orchAttr.writeWarn("custom log entry - warning");
// orchAttr.writeDebug("custom log entry - debug");

// def array = '[{"Column1":"val1","Column2":"val2"},{"Column1":"val3","Column2":"val4"}]';
// returnMap.put("Output Array", array);
// returnMap.put("Output String", stringVal);

String integrationType = (String)inputMap.get("in_IntegrationType_55IT");

if (integrationType=='Type1') {
def jsonType1 = new JsonSlurper().parseText(inputMap.get("in_jsonType1"))
def jsonOut = new JsonBuilder(jsonType1).toString()
returnMap.put("Customers", jsonOut)
}

if (integrationType=='Type2') {
def jsonType2 = new JsonSlurper().parseText(inputMap.get("in_jsonType2"))
def jsonOut = new JsonBuilder(jsonType2).toString()
returnMap.put("Customers", jsonOut)
}


return returnMap;
}
 
I love that we are helping one another on here. Groovy would be new to most of us, so to see practical examples of it in use is helping me learn it no end
 
This is great! so you're building out your variable arrays earlier in the process and just passing them in as strings to this component
 
Hi Dave.

I have 2 different form requests where the number of columns vary. A rule controls which forms request is executed based on the value of an orchestration input variable - "in_IntegrationType_55IT". The groovy code I've included looks at the "in_IntegrationType_55IT" and outputs the correct format in a new json object - "Customers". The "Customers" object is what the orchestration returns.

So our answer is -Yes, one orchestration can have 2 different, uh, very different outputs.
 
An Oracle tech just told me that they may put this code on the KM. With a fiull blown example of all the pieces. In the mean time, if you need help, please let me know.
 
An Oracle tech just told me that they may put this code on the KM. With a fiull blown example of all the pieces. In the mean time, if you need help, please let me know.
Love it!!!! You'll have to present at next conference
 
Back
Top