这是当前的代码:如何循环关系中的项目?
Class %Utcov.Test Extends %RegisteredObject
{
ClassMethod listClasses(ns As %String, projectName As %String)
{
// Switch namespaces to the new one
new $namespace
set $namespace = ns
// Grab our project, by name; fail otherwise
// TODO: failing is CRUDE at this point...
#dim project as %Studio.Project
#dim status as %Status
// TODO: note sure what the "concurrency" parameter is; leave the default
// which is -1
set project = ##class(%Studio.Project).%OpenId(projectName, /* default */, .status)
if ('status) {
write "Argh; failed to load", !
halt // meh... Ugly, f*ing ugly
}
w project.Items
}
ClassMethod main()
{
do ..listClasses("USER", "cache-tort-git")
}
}
首先第一件事情:我知道这些代码很烂......但是,这是学习曲线,我最终会做的更好。我想在这里解决的问题这条线:
w project.Items
在控制台,它目前打印:
[email protected]%Library.RelationshiptObject
,但我想这样做当然是通过这些对象,以循环WH根据文件,ich是%Studio.ProjectItem的“实例”。
如何循环浏览这些内容? WRITE
不会削减它,事实上,我从一开始就猜测它不会......我只是无法弄清楚这是如何在ObjectScript中完成的:/
我偶然发现了这个页面,所以现在我有了对象列表。有一个类型为'PKG'的对象似乎是我想要的...现在我需要能够列出该对象中的文件... – fge