In the PC-IDMC conversion process, it can be challenging to gather detailed information about workflows. Specifically, we often need to determine:
- The number of transformations used in each mapping.
- The number of sessions utilized within the workflow.
- Whether any parameters or variables are being employed in the mappings.
- The count of reusable versus non-reusable sessions used in the workflow etc.
To obtain these details, we currently have to open each workflow individually, which is time-consuming. Alternatively, we could use complex queries to extract this information from the PowerCenter metadata in the database tables.
This section focuses on XQuery, a versatile language designed for querying and extracting information from XML files. When workflows are exported from the PowerCenter repository or Workflow Manager, the data is generated in XML format. By employing XQuery, we can effectively retrieve the specific details and data associated with the workflow from this XML file.
Step-by-Step Guide to Extracting Workflow Details Using XQuery: –
For instance, if the requirement is to retrieve all reusable and non-reusable sessions for a particular workflow or a set of workflows, we can utilize XQuery to extract this data efficiently.
Step 1:
Begin by exporting the workflows from either the PowerCenter Repository Manager or the Workflow Manager. You have the option to export multiple workflows together as one XML file, or you can export a single workflow and save it as an individual XML file.
Step 2:-
Develop the XQuery based on our specific requirements. In this case, we need to fetch all the reusable and non-reusable sessions from the workflows.
let $header := "Folder_Name,Workflow_Name,Session_Name,Mapping_Name" let $dt := (let $data := ((for $f in POWERMART/REPOSITORY/FOLDER let $fn:= data($f/@NAME) return for $w in $f/WORKFLOW let $wn:= data($w/@NAME) return for $s in $w/SESSION let $sn:= data($s/@NAME) let $mn:= data($s/@MAPPINGNAME) return <Names> { $fn , "," , $wn , "," , $sn , "," , $mn } </Names>) | (for $f in POWERMART/REPOSITORY/FOLDER let $fn:= data($f/@NAME) return for $s in $f/SESSION let $sn:= data($s/@NAME) let $mn:= data($s/@MAPPINGNAME) return for $w in $f/WORKFLOW let $wn:= data($w/@NAME) let $wtn:= data($w/TASKINSTANCE/@TASKNAME) where $sn = $wtn return <Names> { $fn , "," , $wn , "," , $sn , "," , $mn } </Names>)) for $test in $data return replace($test/text()," ","")) return string-join(($header,$dt), " ")
Step 3:
Select the necessary third-party tools to execute the XQuery or opt for online tools if preferred. For example, you can use BaseX, Altova XMLSpy, and others. In this instance, we are using Basex, which is an open-source tool.
Create a database in Basex to run the XQuery.
Step 4: Enter the created XQuery into the third-party tool or online tool to run it and retrieve the results.
Step 5:
Export the results in the necessary file extensions.
Conclusion:
These simple techniques allow you to extract workflow details effectively, aiding in the planning and early detection of complex manual conversion workflows. Many queries exist to fetch different kinds of data. If you need more XQueries, just leave a comment below!