Question
· May 1, 2019

List all DTLs and the corresponding target and source types in an Ensemble production

I need to list the source type and target type for all the DTL transformations in an Ensemble  Production.  I know I can get the source and target type for a single  DTL transformation using :

set obj=##class(EXC.DTL.Lamont).%New()

write 'Source type: '_obj.GetSourceType()

write 'Target type: '_obj.GetTargetType()

 

but I do not know how to get it for all the  DTL transformations  in a production. I was thinking I could create an array containing all the DTL transformations but I do not know how to get a  all the DTL transformations programmatically.  Any help would be appreciated.

Discussion (3)1
Log in or sign up to continue

Hi,

Try the following code. It only works if the class parent is Ens.DataTransformDTL

// Create a query to get only my class (in MyClass and sub folders)

set query="SELECT ID FROM %Dictionary.ClassDefinition WHERE ID LIKE 'MyClass.%' AND super='Ens.DataTransformDTL'"

set tStatement = ##class(%SQL.Statement).%New() 

set qStatus=tStatement.%Prepare(query)

set tResult = tStatement.%Execute()

while tResult.%Next() {

   set dtlName = tResult.%Get("ID")

   set classObject = $CLASSMETHOD(dtlName ,"%New")
   
   write !,"DTL: "_dtlName
   write !,"Source type: "_classObject.GetSourceType()
   write !,"Target type: "_classObject.GetTargetType()
   write !

}

Remember: It works only if the class inherits from Ens.DataTransformDTL , if you know which class is the one that inherits the DTL you want to examine, change the name of the value of 'Super' in the previous query

Best regards,

Francisco Lopez