Below is my code, which opens up a Monarch instance, and does some actions with Monarch (Monarch is a datamining tool)
I have to repeat the below code, simply changing a few parameters each time, is there a way to programatically do this? I want to know the most effeicent way of doing this.
a = MonarchObj.SetReportFile(rawdataS10, False)
openModel = MonarchObj.SetModelFile(freeKidsModel)
MonarchObj.CurrentFilter = "Under 60"
SummerDateShow = MonarchObj.SetFieldVisible("Date2", False)
SummerDateHide = MonarchObj.SetFieldVisible("Date", True)
ExportTOS = MonarchObj.JetExportTable(saveDir, "FreeKidsS10", 0)
MonarchObj.CloseAllDocuments
An example of the parts i’m changing are “Under 60” “FreeKidsS10” and the Date & Date2 fields.
If simply copy and pasting this code is the most effecient code, you can tell me to go away
You could make a procedure that takes as parameters the variable fields and then call that procedure wherever you would otherwise copy and paste. The signature of that method would be something like this:
Thus the entire method would look something like this: