Add/Call objectscript xml class methods
Hi All,
I have been given the following xml class file with objectscript code that has methods that I need for file conversions. These method implementations will do necessary conversions but I don't know how to add it to Iris studio and run it as a task or maybe if it must be put on any location and call each method from the terminal and even if so how do I then call it.
Please advise how to go about this.
<?xml version="1.0" encoding="UTF-8"?>
<Export generator="IRIS" version="26" zv="IRIS for Windows (x86-64) 2020.1.1 (Build 408U)" ts="2022-02-01 16:19:05">
<Class name="User.Ready.ConvertCSV">
<Super>%RegisteredObject</Super>
<TimeChanged>66141,58621.837791</TimeChanged>
<TimeCreated>65814,24388.941304</TimeCreated>
<Method name="DoAll">
<ClassMethod>1</ClassMethod>
<Implementation>
</Implementation>
</Method>
<Method name="ConvertN">
<ClassMethod>1</ClassMethod>
<Implementation><![CDATA[
</Implementation>
</Method>
<Method name="ConvertI">
<ClassMethod>1</ClassMethod>
<Implementation><![CDATA[
s filename = "C:\ready\In\I\I.csv"
s newFilename = "C:\ready\Out\I.csv"
]]></Implementation>
</Method>
<Method name="ConvertS">
<ClassMethod>1</ClassMethod>
<Implementation><![CDATA[
s filename = "C:\ready\In\S\S.csv"
s newFilename = "C:\ready\Out\S.csv"
/Implementation>
</Method>
</Class>
</Export>
if you import this class into IRIS you will then be able to run the methods. Look up the docs for $system.OBJ.Load() .. you will load and compile the class and the. you can call the methods like this:
Do ##class(User.Ready.ConvertCSV).ConvertN()
(I assume you cut out the actual logic of the methods when you pastes it above as what you pasted is incomplete)
Thanks Ben,
Yes I did cut the actual logic,so I must Import this class under %SYS namespace right?
Import it in the namespace where you want to use it. You can also use Studio to import: Tools > Import Local.
avoid loading anything into %SYS unless it is a class / routine that starts with a "z" ... everything else will be overwritten when you upgrade InterSystems IRIS. If you ever want to class to be available to all namespaces, you can call it %z<some name> and load it into %SYS and then you can call it from all namespaces and it should survive an upgrade.
Let us know if you got it working!
Than you guys,I got it working however I am not able to load the file codes on the system.do you know how the structure should look like when uploading terminology codes file under Registry namespace?
Below is the error I am getting the below error
I am afraid I have no experience in this area. I suggest that you ask this as a new question posting tagged as HealthShare so that you're more likely to get the attention of those who may know the answer