go to post Eduard Lebedyuk · Feb 21, 2017 %occOID.inc defines macros to use for work with oid: set id = $$$oidPrimary(oid) set class = $$$oidClassName(oid) set global = $$$oidSysAd1(oid) // streams only set oid = $$$idCurrent //get current object oid
go to post Eduard Lebedyuk · Feb 16, 2017 Filename is appended to directory, so if you have a directory: /tmp/ you can call set tSC = ..Adapter.PutString("old/plan.txt",output) set tSC = ..Adapter.PutString("new/plan.txt",output) and it should produce two files /tmp/old/plan.txt and /tmp/new/plan.txt in two different subdirectories. of /tmp
go to post Eduard Lebedyuk · Feb 16, 2017 The benefits of using list of %String over just %String are: You can easily index individual valuesYou can project and access values as a separate table I actually had a use case for exactly this data. Requirements were: There are alerts and usersAlerts are sent once an hourEach alert is sent to multiple usersEach user should receive only one digest email with all relevant alerts List of %String was extremely useful in this case. First I wrote a temp table: /// Store alerts (for current process and runtime-only) Class Util.Alert Extends %Persistent { /// Alert topic Property topic As %String(MAXLEN = 1000) [ Required ]; /// Alert text Property text As %String(MAXLEN = ""); /// Recipients Property emails As list Of %String(SQLPROJECTION = "table/column", STORAGEDEFAULT = "array"); /// Index Index emailsIndex On emails(ELEMENTS); /// Add one Alert /// w ##class(Util.Alert).add("Error", $lb("1@1.com","2@2.com"), "text") ClassMethod add(topic As %String, text As %String, emails As %List) As %Status { set obj = ..%New() set obj.topic = topic set obj.text = text if $listvalid(emails) { for i=1:1:$ll(emails){ do obj.emails.Insert($lg(emails,i)) } } return obj.%Save() } } Next I wrote a business service which searched for alerts and added them to this table (not relevant for this discussion). And then once all alerts for an hour are in the Util.Alert table, sendEmails method can easily send alerts in digest mode: /// Generate emails from alerts and send them ClassMethod sendEmails() { &sql(DECLARE C1 CURSOR FOR SELECT DISTINCT emails INTO :email FROM Util.Alert ) &sql(OPEN C1) &sql(FETCH C1) While (SQLCODE = 0) { set text = ..generateEmailText(email) do ..SendEmail(email, text) &sql(FETCH C1) } &sql(CLOSE C1) } /// Create email with all alerts for user ClassMethod generateEmailText(email As %String) As %String { set emailText = "" &sql(DECLARE C2 CURSOR FOR SELECT topic, text INTO :topic, :text FROM Util.Alert WHERE FOR SOME %ELEMENT(emails) (%VALUE=:email) ) &sql(OPEN C2) &sql(FETCH C2) While (SQLCODE = 0) { set emailText = emailText _ topic _ ": " _ text _ $$$NL &sql(FETCH C2) } &sql(CLOSE C2) return emailText } Without list of %String SQL here would be far harder to write or slower.
go to post Eduard Lebedyuk · Feb 15, 2017 You can define OnInit method for Ensemble BS/BO/BP class, with the code retrieving any external value.
go to post Eduard Lebedyuk · Feb 14, 2017 First run: csession CACHE Then: w ##class(%SYS.System).InstanceGUID() As %SYS is a % package it is available in every namespace.
go to post Eduard Lebedyuk · Feb 12, 2017 What's the problem with specifying default value for filter control?
go to post Eduard Lebedyuk · Feb 10, 2017 Static files were edited outside of Studio.Setting timeout to 0 and purging the cache once solved the problem.
go to post Eduard Lebedyuk · Feb 10, 2017 Reading %CSP.StreamServer makes me think that I need to set "Set Files Timeout" to 0.Testing that.
go to post Eduard Lebedyuk · Feb 9, 2017 Add this parameter to class: Parameter USECOMMONDIRECTORY = 1;
go to post Eduard Lebedyuk · Feb 8, 2017 Workflow REST API is a separate project available on GitHub. You can install it on any version that supports REST, so Caché 2014.1+.
go to post Eduard Lebedyuk · Feb 8, 2017 Have you read relevant documentation?There is also free online course Setting Up Alerts.
go to post Eduard Lebedyuk · Feb 6, 2017 What is a "Business Server"?You shouldn't specify Dispatch Class -it's for REST only.Maybe add ?CfgItem=Weather to URL.EnsLib.SOAP.GenericService is a generic service and it does not implement actual services, such as weather but send the request to actual business host - "Weather BO" in your case.Your original URL is correct as it references business host name instead of class name
go to post Eduard Lebedyuk · Feb 6, 2017 Using JDBC you can call SQL procedures, which are Caché methods.Additionally, you can access Caché objects and call methods via Caché Java binding.