Many mobile applications that enable users to get information about road fines and pay them, send notifications about newly added fines. This functionality can be efficiently implemented using push notifications sent to users’ devices.
Our application was not an exception. The server side is based on the Ensemble platform that offers integrated support of push notifications starting from version 2015.1.
Consider you need to exclude substring(s) from a string.
I did it with the following snippet:
/// excludes all the substrings from the string
ClassMethod ExcludeSubstring(substr,str as %String) As %String
{
while ($L(str,substr)>1) {
set str=$Piece(str,substr)_$Piece(str,substr,2,*)
}
quit str
}
Is there a better way to iterate through all properties of an object than the following? Perhaps without needing to open a definition of the class but directly against the object?
Environment: Cache for Windows (x86-64) 2015.2.2 (Build 811U) Thu Mar 3 2016 12:55:48 EST [HealthShare Modules:Core:14.01.351
When try the following to send back SOAP Fault, is the following correct way?
Set fault=##class(%SOAP.Fault).%New() Set fault.faultcode=$$$FAULTServer Set fault.faultstring="Processing Error" Set fault.detail= "Error on server" Do ..ReturnFault(fault)
Here you have an easy way to write and execute COS code from your unix scripts. This way one does not need to write routines or even open Studio or Atelier. It can be an option for simple and small actions for instance things like installation tasks or compiling.
See sample bash script (compile.sh) to compile classes:
With a routine like this one, you can quickly calculate how many lines of code you are working with. And it is not only for routines, it works for classes because remember that classes generate routines !
Outlined below is an example of how to check if a directory exists:
Set directoryName="c:\temp\nosuchdir"
/* Check for existence of a directory - Return Value: 0 - directory does not exist; 1 - directory does exist */
Set directoryExists=##class(%File).DirectoryExists(directoryName)
If ('directoryExists) // do the processing for when a directory does not exist
Outlined below is an example of how to check if a file exists:
We're developing Ensemble PoC and one day our frontend developer (who doesn't have Ensemble production running) said that Populate just doesn't cut it and he needs to see the real data. He needed only one object, but the problem was - it's a big object. Still, I checked ids of everything related and wrote this command (parts omitted, but you get the idea):
Process-private Globals can be used as a data global in storage definition. That way, each process can have its own objects for the class with ppg storage. For example lets define a pool, which can:
Several years ago, long before Developer Community Portal was launched, I published a series of Caché tricks at one of Czech web sites. In this article, I’m posting translated version of one of them.
Capturing output of someone else’s methods or routines
Suppose you, or someone else created a useful method or routine, that was producing some computation that you’d like to benefit from, but the routine was writing output to process principal device.
You would like to use the data, but you need it not written to a device, but assigned to a variable. And, for any reason, you can’t modify the code. What can you do?
This article created as side effect of preparations to the longer set of articles about simple, but still handy MapReduce implementation in Caché. I was looking for relatively easy way to pass arguments to (potentially) multiple targets via remote calling facilities. And after several attempts I have realized that we do have very powerful mechanism in the Caché ObjectScript which might be of particular help here – dynamic dispatch for methods and properties.
I am new to Cache and I am trying to convert a JSON string (msgdata) that contains a JSON payload to an object to be saved into a Driver. Entity table. I am running into 2 issues and would appreciate any help:
1) It seems that when the 1st element of a list within the payload (Choices) is an empty string, after I call %ConvertJSONToObject, the obj.%data("payload").Choices contains just 1 empty element, removing the next 3 valid values (10,20,30). The same does not happen if I change the input to [10,20,"",30], in this case it works correctly.
I've been trying to write a method to compare two local variables, which may be arrays, for "equality" - that is, to see if they have all the same subscripts (if they're arrays) and values. This is the best I've come up with so far - are there any better/simpler approaches out there?