E9.2 Flat orchestration input. Pivot specific columns for interation into multiple detail lines?

DaveWagoner

DaveWagoner

Reputable Poster
Hi folks,

I have an orchestration input that is flat-- column1,column2,column3,column4

The destination is a header/detail. column1 and column2 would be header, and then I need 2 detail lines-- one for the value of column3, and another for the value of column4.

I'm still getting the hang of things so not sure how to best approach this. Should I go nuts on trying to reformat the input (its possible) or is there a method I'm not thinking about to get this done using groovy or just vanilla orchestration components?

We don't yet have logic extensions.

Thanks in advance!
 
Hi folks, thought I'd follow up on myself. A colleague sent me to this oracle by example article, and I've linked to the bookmark containing the relevent script. It looks great and is formatting a flat file into JSON. But it is using JRuby, and I'm on an instance using just Groovy. So I looked for something similar there.

This article gives a nice overview of JsonBuilder as well as a multi-use example. I was able to massage this a bit and import it into the groovy format that comes from orchestrator studio. Of note is that where the script example in orchestrator studio lists "String stringVal = (String)inputMap.get("inputStringVal");" as a way to grab a variable from orchestrator component mapping, leaving out the (String) is necessary if you're using inputmap.get method within the builder object. So it ends up looking like the following (note that I didn't give the root node a name, I think this should make import of the json object into an orchestration input seamless, as in the oracle example):

Code:
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>();

  // source for below: http://docs.groovy-lang.org/next/html/gapi/groovy/json/JsonBuilder.html

  def json = new groovy.json.JsonBuilder()
  def root = json {
               'Var1' inputMap.get("Var1")
               'Var2' inputMap.get("Var2")
               'Var3' inputMap.get("Var3")
               address(
                       city: 'Paris',
                       country: 'France',
                       zip: 12345,
               )
               married true
               // a list of values
               conferences 'JavaOne', 'Gr8conf'
           }
      
   returnMap.put("jsonOut", json);
  return returnMap;
}
 
Back
Top