Is it possible to retrieve the graphname in a Transformation? For our application, we have audit fields to store which object created or last updated a row, and rather than hard coding a graph name that may or not be maintained, I would rather retrieve it from the system.
It appeared getGraph().getGraphProperties().getProperty(“JOB_FILE”) had some promise, but in a transformation it returns a Function ‘getGraph’ is not declared error message.
Yes, exactly, for retrieving the graph name in a Transformation we are using parameter JOB_FILE or GRAPH_FILE (both mean the same in a graph). You can work with each of them the same way as you would with any other parameter without explicitly defining it.
In means that you don’t need to worry about the Java code at all and in order to get the graph name you can use the following in you CTL transformation (e.g. in Reformat component):
$out.0.graphName = "${GRAPH_FILE}";
It will get a path to the graph location within the current project (something like “graph/getnamegraph.grf”) and store it into the “graphName” field.
In addition, you can also apply following functions to the parameter:
$out.0.graphname = getFileName("${GRAPH_FILE}"); // the result from the example above would then be "getnamegraph.grf" or
$out.0.graphname = getFileNameWithoutExtension("${GRAPH_FILE}"); //result "getnamegraph"
Please let me know if this meets your requirements or if further assistance is needed.