Kevin Furze · Mar 13, 2018

problems renaming/copying classes

Cache 2016.2.1.603 for windows)

I created a few classes and one class called jitPod.Api.toServer.additionalConsignments and realised even before I did any work,, that the word "Api" (note capital A) needed to be "api" (all lowercase)

it would not allow copying the class to the lowercase name because the directory already exists (i understand that)

so I exported the class to an XML, edited the xml to become lowercase "api" , deleted all the classes (and directory name) and re-imported the class.

when I looked at the class, it seems to be in the lowercase "api" directory, but the actual defintion still reads "Api"  (Hope your following this)

Now, I have some classes in the "Api" directory, and some in the "api" directory, some definitions seem to read "api" and some read "Api"

when I look on the "open a class" folder, I only see "api", but when I copy a class from within studio, I see both "api" and "Api" folders (clearly one's a red herring)

then it gets worse, and I don't know if its to do with the reaming of the folder or not.

I amended one of the correct "api" (lowercase) classes, and added a new class that would be used as a master class, so came up with 

Class jitPod.Api.fromServer.memos Extends jitPod.api.fromServer.master

now, on those classes that remain with "Api" (capital A) will NOT accept the changes to the Extends parameter. it continually resets back to %RegisteredObject.

so clearly there's something lying around in the system that still remembers "Api", and is getting in the way,

anybody got any ideas how to totally clear the "Api" version, whilst retaining the "api" version.

I've tried restarting cache, deleting everything at the top level, exporting, importing, but still can't get rid of that "Api"


0 634
Discussion (19)5
Log in or sign up to continue

Hi Keven,

I don't have an answer. From experience deleting the old class should be enough and the new name should have then just worked.

Out of interest are you using Studio or Atelier?


not YET ventured on to Atelier

I was wondering the same thing, seeing how Kevin referred to "directory" names. But given that he tagged the post as "Studio" I assumed he meant "package" rather than "directory".

Thanks john.

I guess I'm using a package called "jitPod.Api.toServer" it could be construed as "directory" because the directory structure gets created upon the save. Its part of the className

the full classname would be jitPod.Api.toServer.logon

either way, I've explicitly put in "Api" but get "api" - It doesn't matter which way round ie starting with "ApI" and changing it to "api" , the old value gets left lying around on SOME classes despite trying to change them to the uppercase version of the lowercase version

There is a directory somewhere in windows that stores temporary files for studio.

Could be this has old versions of some classes.

I had a similar problem when doing bulk code changes on xml files.

Shut down studio. Delete the dir. 

I can' remember where it is. It's 3am. When I really wake up I will find it.

thanks Paul, 

it's got to be something like that,

for now, there's too many things in that directory that's messed up, and I need to press on.

I've taken the opportunity (temporarily ?) to move the API to a different structure by simply taking the xml, renaming all occurances, and uploading and now I have 



its not a solutiion I like, but it allows me to get on with coding.

I'd still love to know if there is such a directory please because I can then keep all the "jitPod" files in one total directory structure.


C:\Users\%USERNAME%\AppData\Local\Application Data\Temp\InterSystems\


thanks for that directory name, really useful

If I close cache down, can I then safely delete the contents and allow them to auto re-build when I next import the package.xml ? I'm assuming if I did this, it would force the xml file contents to be recognised 100% correctly


it seems that the main point here is to stop Studio before deleting the content; not necessary to stop Caché.

BTW, there should be several subfolders inside, one for each server/namespace connection you've ever established.

Many thanks, I'll play over the weekend and make sure its a 100% test together with Eduard's answer.

Hi Peter, Long time no hear. Hope you're well.

I'll try Eduard's answer first - seems comprehensive, but if that fails, I'll certainly be tying yours

thanks Eduard,

I'll try the steps.

it's the first time the process has failed in all these years, seems to be a little bit glitch somewhere



Something still not right.

I've followed the steps exactly, and it's still wrong.

here's one of those files, The definition on line 3 clearly still wrongly refers to "api" (lowercase) but the workspace inspector  on the right clearly shows "Api"

the xml file was definitely edited to  be all uppercase "Api"

any other clues


Hi Kev

Hope you are keeping well

Have you tried

write $System.OBJ.UnCompile("*") from terminal? - replace the "*" with more specific wild card

write $System.OBJ.Delete("class name") 


write $System.OBJ.DeletePackage("package name")

I had similar issues -but difficult to pin down


Studio is less important here.

What does this return:

write ##class(%Dictionary.CompiledClass).%ExistsId("jitPod.Api.toServer.logon"),!
write ##class(%Dictionary.CompiledClass).%ExistsId("jitPod.api.toServer.logon"),!
zwrite ^oddPKG($zcvt("itPod.api", "U"))

exactly as we expected, "Api" exists, and "api" does not

and neither is within the ^oddPKG.

I've added the exact cut and paste from the xml file,  and everywhere we look, it refers to "Api", so I just don't know where the "api" has come from


JIT>write ##class(%Dictionary.CompiledClass).%ExistsId("jitPod.Api.toServer.logon"),!
JIT>write ##class(%Dictionary.CompiledClass).%ExistsId("jitPod.api.toServer.logon"),!
JIT>zwrite ^oddPKG($zcvt("jitPod.api", "U"))
JIT>zwrite ^oddPKG($zcvt("jitPod.Api", "U"))

and here's the snippets from the xml file

    <ProjectItem name="jitPod.Api.toServer.logon" type="CLS"></ProjectItem>

<Class name="jitPod.Api.toServer.logon">
the user is asking to login
{"username":"kvin", "password": "secret"}</Description>

You're importing


and that's whats imported. I think you skipped step 5, where you replace all reference to Apiwith api.

Step 5 has NOT been missed,

I've tried it BOTH ways, following all the steps and at step 5 changing everything to "api" (lowercase) before continuing to import, then when that didn't work, I tried following all the steps again, this time changing it to "Api" within the exported xml before importing  the file in steps 6 onwards,

either way, after following all steps to the letter,  for some reason, the xml importer does not seem to respect the uppercase/lowercase mix of the word "Api" - some get converted without any change at all, others will change the case of the "api" word - can't spot the common cause is


1. Export Api package.

2. Uncompile and Delete all classes from Api package regardless of the case.

3. Delete package with

write $System.OBJ.DeletePackage("package name") 

4. Check if there's anything related to jitPod.Api package left in:

zw ^oddPKG

Delete ONLY entries related to your package.

5. In exported code replace Api with api for all classes. 

6. Restart Cache.

7. Import classes.