What If: Root Variables are Not Rendered in Mapping?

What If Root Variables are Not Rendered in Mapping

Variables in APPSeCONNECT are special storage locations that help in intermediate calculations without reflecting any update on the source or target output file. The ProcessFlow allows you to declare variables, update their value, work with them or even print it in the output file. Variables come very handy to develop a logic around the data such that complex calculations could be easily broken down into smaller counterparts, and the values could be replaced whenever required.

A variable has different scopes.

  1. ProcessFlow: A ProcessFlow scoped variable could be present in any nodes of the entire ProcessFlow, such that the same variable could be used in different nodes of the flow.
  2. Node: A node-specific Variable is also defined inside a node, but will only be scoped inside the same node and no other node could use it.
  3. Mapper: As the mapper creates the transformation logic, hence different elements have variables in Mapper.
    • Root Variables: Some variables are declared at the Root scope of the transformation which helps in determining a value for the whole document.
    • Root Entity Variables: These variables are declared inside each data packet of transformation. Hence they can point to individual values of a packet.
    • Local Scoped Variable: These variables are in an internal scope, and are available to that scope only. The parent elements will not have their values.

Connect all your business applications under one single platform to automate the business process and increase your productivity and efficiency!Integrate-Business-Apps-through-APPSeCONNECT

The Problem

A variable in Mapper is rendered into the script file. Now script does have a template, and each section of the mapper is getting replaced by the template. The main template which is used by the mapper is defined in the protocol section of the destination App. Let us open the Protocol section to see the different sections.

Now in the template file, you can easily see the root variable token is there but rootEntityVariable is not. In this case, even though you specify the root entity variables inside the mapping section, you still do not see the actual existence of it in the script and hence it will keep on complaining about the variable during transformation.

The Solution

Now to solve this issue, the only thing that you can do is to add the [rootEntityVariable] token inside your template file. This will include in the actual script.

In the above script, you can see the token is rightly added inside the for each loop, which indicates, if we declare variables inside the Root Entity section, it will be properly rendered. The root variables are important to ensure calculations could be made inside the loop such that all the data could be individually identified.

Hope this will help.

Connect all your business applications under one single platform to automate the business process and increase your productivity and efficiency!Integrate-Business-Apps-through-APPSeCONNECT

Search

Free Trial / Demo

Try the APPSeCONNECT Integration Platform for 30 Days or request a free demo.

This website uses cookies to ensure you get the best experience on our website.