The best way to list, edit, save and delete globals is using an IDE. Now, it is possible if you use VSCode. It is also possible to save globals using yaml files. Perform the following steps:
1. Get an InterSystems IRIS instance and install the application iris-global-yaml:
zpm:USER>install iris-global-yaml
BashBash
2. If you just to want an InterSystems IRIS trial for tests git clone and run on docker:
git clone https://github.com/yurimarx/iris-global-yaml.git
docker-compose up -d --build
BashBash
3. Go to https://openexchange.intersystems.com/package/IRIS-Global-VSCode-Editor, click GitHub button, look for iris-global-editor-0.0.1.vsix file, and save it in your local disk.
4. Now, open your VSCode IDE and click extensions:
5. Click the button ... and select Install from VSIX...:
6. Select the vsix file from your local disk to install (if installation fails, update your VSCode for the most recent VSCode binary and try again):
7. Go to View > Explorer:
8. Create or edit the file .vscode/settings.json with connections settings (edit with your host, port, namespace and credentials):
"conf.irisGlobalEditor.serverconfig": {
"host": "http://localhost:52773",
"namespace": "USER",
"username": "_SYSTEM",
"password": "SYS"
}
JSONJSON
9. Go to the tab INTERSYSTEMS IRIS GLOBALS and click the button refresh:
10. The VSCode list all globals in the configured namespace:
11. On top of the tab, click the plus button to create a new global:
12. Write the global name and your value and press enter:
13. Click refresh button again and see your new global on bottom:
14. Now click the editor button (last button) to create a yaml file to edit your global:
15. A new yaml file is created with the global content:
16. Edit the yaml to insert subscripts into your global (it is very important use indentation with 4 spaces):
# IRIS-Global-YAML
USER:
^test:
value: InterSystems IRIS
subscripts:
- ^test(1): 1
- ^test(1,1): 1.1
- ^test(1,2): 1.2
- ^test(2,1): 2.1
- ^test(2,2): 2.2
- ^test(2,3): 2.3
- ^test(2,4): 2.4
YAMLYAML
17. Save the file on any project folder and the global content will be saved on IRIS Server:
18. Try the delete buttom also and enjoy!
Great initiative!
Reading works, but editing and saving doesn't. Created global ^AAA first (in terminal), then read it in VSCode, opened YAML file, edited, saved in /data/gl folder - how can data can be imported to IRIS?
the problem is the name of the file, use names without special chars and format the document before.
But it is the extension that creates a file with such a name, no?
Execute format document before and will works, and choose a file name without special chars.
Also, it'd be great to open the tab with the YAML file when clicking on Editor.
Also it'd be great to search/filter globals in the list, ideally with wildcards, e.g. ^Project*
Implemented!
Tried to use it but:
It'd be great to include global name into the YAML file name
Hi Yuri,
Your video is available on InterSystems Developers YouTube:
⏯️VSCode Global Editor for InterSystems IRIS
https://www.youtube.com/embed/OjgLrQVl3ck?si=yIU-iWwXMay-_9X1
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]
How to deal with globals that contain $lb and $bit data?