Eduard Lebedyuk · Aug 23, 2018 go to post

I do not think that it's possible.

If display values are unique, you can build a unique index and use it to translate display value into id.

Eduard Lebedyuk · Aug 23, 2018 go to post

You can subclass Ens.ContextSearch to provide dynamic settings lists. Docs.

Here's a sample class  that adds ability to select XData in Ensemble setting.

/// Ensemble settings interface implementation
Class Package.EnsSearchUtils Extends %ZEN.Portal.ContextSearch
{

///Get class Xdata list.
ClassMethod GetXDatas(Output pCaption As %String, Output pTopResults, Output pResults, ByRef pParms As %String, pSearchKey As %String = "") As %Status
{
    Set tStatus = $$$OK
    Kill pResults, pTopResults
    Set pCaption = ""

    Set tClass = $get(pParms("class"))
    If tClass '= "" {
        Set tClassObj = ##class(%Dictionary.CompiledClass).%OpenId(tClass)

        For i=1:1:tClassObj.XDatas.Count() {
            Set pResults($i(pResults)) = tClassObj.XDatas.GetAt(i).Name
        }
    }
    Quit tStatus
}

}

For example to add a setting XSLTTransformation to BH that would allow me to choose on XData from my Package.XSLT class, I can specify SETTINGS parameter like  this:

Parameter SETTINGS = "XSLTTransformation:Basic:selector?context={Package.EnsSearchUtils/GetXDatas?class=Package.XSLT}";
Eduard Lebedyuk · Aug 23, 2018 go to post

Do you want to get a list of possible values at runtime?

If so consider making your property object-valued:

Property PrdType As Demo.Data.PrdType;

If you do want to build a list once at compile time, then it is probably possible using method generators, but I would not recommend this approach.

Eduard Lebedyuk · Aug 23, 2018 go to post

Not an answer, but you can use LIST function to remove cursors and simplify code.

ClassMethod GetTypeDisplay() As %String
{
    &sql(SELECT LIST(DISTINCT TypeName) INTO :result FROM Demo_Data.PrdType)
    q result
}

ClassMethod GetTypeValue() As %String
{
    &sql(SELECT LIST(DISTINCT TypeId) INTO :result FROM Demo_Data.PrdType)
    q result
}
Eduard Lebedyuk · Aug 23, 2018 go to post

You should not modify system classes.

So without

Set httpRequest.SSLCheckServerIdentity=0 

it doesn't work?

Eduard Lebedyuk · Aug 22, 2018 go to post

I use

set var1 = "value1"
set var2 = "value1"
set var3 = "value1"
set var4 = "value2"
set var5 = "value2"
set var6 = "value3"
set var7 = "value3"
set var8 = "value3"

as it's the most readable. Or 

#dim var1 As Type = "value1"

Time spent on local sets is usually a pittance of all CPU time spent.

Eduard Lebedyuk · Aug 22, 2018 go to post

You seem to receive empty response.

What does

set resp = httpRequest.HttpResponse
zwrite resp
write !,!,!
do resp.OutputToDevice()

Output?

Eduard Lebedyuk · Aug 22, 2018 go to post

Check that stream is an object and contains relevant data:

write $isObject(httpResponse)

what data does it contain:

do httpResponse.OutputToDevice()

if it's not an object - what is it?

zwrite httpResponse

If everything is okay - stream contains what you expect it to contain, then what is the status of convert operation:

Set sc = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(httpResponse,,.Object,1)

write $System.Status.GetErrorText(sc)
zwrite Object
Eduard Lebedyuk · Aug 20, 2018 go to post

1.

SELECT
parent As Class,
Properties
FROM %Dictionary.CompiledIndex
WHERE IdKey=1

2.

SELECT
parent As Class, Name, Type
FROM %Dictionary.CompiledProperty
WHERE Type='%Library.Integer' -- Name='Property' AND parent='Class'

3.

SELECT 1 As "Exists"
FROM %Dictionary.CompiledIndex
WHERE _Unique=1 AND parent = :Class AND Properties = :Property
Eduard Lebedyuk · Aug 20, 2018 go to post

You can map ^DeepSee.Folder and ^DeepSee.FolderItem globals, but it would map all dashboards from one NS to another.

Eduard Lebedyuk · Aug 17, 2018 go to post

Generally speaking, inside Caché you must have two functions

InternalToExternal(name) As %String

ExternalToInternal(path) As %String

That translate Cache names (/app/index.csp) into filenames (i.e. C:\Temp\MyRepo\CSP\app\index.csp) and vice versa.

Your CI system should:

  1. Build git diff between target commit and environment current commit. Sample code.
  2. Separate diff into 2 parts: added/modified and deleted.
  3. Load added/modified files into Cache.
  4. Translate external names for deleted list into internal names.
  5. Delete items from deleted list.
  6. Set current environment commit equal to target commit

Here's a series of articles on building a CI/CD pipeline for InterSystems Cache.

Eduard Lebedyuk · Aug 16, 2018 go to post

I ran InterSystems IRIS containers via Rancher and Portainer it's all the same stuff. GUI over docker run.

Eduard Lebedyuk · Aug 16, 2018 go to post

can I deploy a container manually

Sure, to deploy a container manually it's enough to execute this command:

docker run -d
  --expose 52773
  --volume /InterSystems/durable/master:/data
  --env ISC_DATA_DIRECTORY=/data/sys
  --name iris-master
  docker.eduard.win/test/docker:master
  --log $ISC_PACKAGE_INSTALLDIR/mgr/messages.log

Alternatively, you can use GUI container management tools to configure a container you want to deploy. For example, here's Portainer web interface, you can define volumes, variables, etc there:

it also allows browsing registry and inspecting your running containers among other things:

Eduard Lebedyuk · Aug 16, 2018 go to post

This info does not seem to be available by default.

You can define JOB^%ZSTART that would set global:

Set ^TimeStarted($job) = $h

And JOB^%ZSTOP:

Kill ^TimeStarted($job)

And reference this global to get process start time.

Eduard Lebedyuk · Aug 16, 2018 go to post

what do I need to have on a production host initially?

First of all you need to have:

  • FQDN
  • GitLab server
  • Docker Registry
  • InterSystems IRIS container inside your Docker Registry

They could be anywhere as long as they are accessible from production host.

After that on a production host (and on every separate host you want to use), you need to have:

  • Docker
  • GitLab Runner
  • Nginx reserve proxy container

After all these conditions are met you can create Continuous Delivery configuration in GitLab and it would build and deploy your container to production host.

In that case how Durable %SYS and Application data (USER NAMESPACE) appear on the production host for the first time? 

When InterSystems IRIS container is started in Durable %SYS mode, it checks directory for durable data, if it does not exist InterSystems IRIS creates it and copies the data from inside the container. If directory already exists and contains databases/config/etc then it's used.

By default InterSystems IRIS has all configs inside.

Eduard Lebedyuk · Aug 16, 2018 go to post

Are you using JTDS driver?

If so, check out the FAQ.

First of all, you seem to pass user=domain\username (in your case user=osumc\CPD.Intr.Service), but FAQ offers domain parameter. Other parameter that seems promising is useNTLMv2.

Try to pass:

user=osumc;domain=CPD.Intr.Service;useNTLMv2=true
Eduard Lebedyuk · Aug 15, 2018 go to post

Try:

set st = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(responseStream,,.obj,1)

obj would become %ZEN.proxyObject. You can also create a class and parse json into object of that class.

Eduard Lebedyuk · Aug 15, 2018 go to post

In my opinion schema-less data (NoSQL, dynamic objects, globals) does not particularly exist. All that happens when you create schema-less data structures is that data validation and enforcing schema becomes someone else problem. Usually that means application programmer. That's why if  possible, consider using strict schemas - the more assumptions about the data you can guarantee, the less validation client application need to do. Also process of data cleansing, reporting and so on become much easier.

That said there are some use cases where using schema-less data is the way to go:

  • For new applications/mock-up/PoC, when schema is unknown
  • When schema is very extensive and changes often
  • When speed is very important and data is retrieved by key (no complex queries)

To sum up, don't use schema if creating it and maintaining it would be a considerably more time-consuming affair than creating and maintaining application/reporting level data validation.

That said I see dynamic objects available in Caché mainly as a means to convert data from/to JSON.

With InterSystems IRIS we introduced DocDB - document database, based on dynamic objects, check it out.

Also mentioning @Stefan.Wittmann.

Eduard Lebedyuk · Aug 15, 2018 go to post

Is

1POST /test/ HTTP/1.1 

actually a part of the request body?

If so, it's invalid json and you need to remove it from request body. What does

do httpRequest.EntityBody.OutputToDevice()

shows right before  sending the request?

Other thought, iin property should be passed as string, not as number. To do that:

1. Create a class

Class MyApp.Request Extends %RegisteredObject {

Property iin As %String;

... other properties ...

}

2. After that instead of %ZEN.proxyObject use this object as a request body.

Note that %ZEN.Auxiliary.jsonProvider:%WriteJSONStreamFromObject method has a pFormat argument, which defaults to aceloqtw in %ObjectToJSON method. One of the flags, q  means  output numeric values unquoted even when they come from a non-numeric property and you don't need that.

So your code should look something like this:

Set Object = ##class(MyApp.Request).%New()
Set Object.iin="123132132"
Set Object.firstName=name
Set Object.lastName=surname
Set Object.middleName=middlename
Set Object.birthDate=birthDate
Set Object.contractType="Z001"
Set sc = ##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONStreamFromObject(httpRequest.EntityBody, Object, , , , "aelotw")
Set sc = httpRequest.Post("", 2)
Eduard Lebedyuk · Aug 14, 2018 go to post

Minor note, you don't need this line, remove it (it may be causing your error):

set sc = ##class(%ZEN.Auxiliary.jsonProvider).%ObjectToJSON(Object)

"Corrupt body: json: cannot unmarshal number into Go struct field CheckContractRequest.iin of type string". 

Where you get this error? This looks like an error you get from the server you send your request to.

Can you get output from

Set sc = httpRequest.Post("", 1) 

Set sc = httpRequest.Post("", 2)

And post it here.