Matjaz Murko · May 28, 2022 go to post

Hi.

In this part of the code:

Set Line = File.Read(1000)
While (File.Read(1000)'=""{ S mystring=mystring_File.Read(1000)

you are reading first 1000 chars which are not included in mystring and again in each loop checking the while condition you are reading 1000 chars and this chars are not included in mystring.

It should be:

//Set Line = File.Read(1000)
Set mystring = ""
While ('File.AtEnd{ S mystring=mystring_File.Read(1000) }

Regards,
Matjaž

Matjaz Murko · May 17, 2022 go to post

Hi.
You are getting pure html, not a JSON serialized string. You need the correct URL/port where the REST server is listening.

Regards,
Matjaž

Matjaz Murko · May 16, 2022 go to post

Hi.

Set request=##class(%Net.HttpRequest).%New()
Set request.Server="something.com"
Set request.Port="some_port"
Set request.Username="some_username"
Set request.Password="some_password"

Set status=request.Get("some_url")
Do request.HttpResponse.Data.Rewind()
Set jsonString=request.HttpResponse.Data.Read(request.HttpResponse.Data.Size,.sc)

Set jsonObject={}.%FromJSON(jsonString)
Write jsonObject."some_property"
...

Something like that...

Regards,
Matjaž

Matjaz Murko · May 16, 2022 go to post

Hi.

There is a COS function $ISVALIDNUM where you can check if the variable is valid number.

Regards,
Matjaž

Matjaz Murko · May 6, 2022 go to post

Hi.

It works with the parameter JSONLISTPARAMETER set to "DISPLAYLIST". But is it possible to set that parameter in XData mappings, so it can be use either way (DISPLAYLIST or VALUELIST)?

Regards,
Matjaž

Matjaz Murko · May 4, 2022 go to post

Hi.

Class code:

Class MasterData.Product Extends (%Persistent, %JSON.Adaptor)
{
Property Department As %String;
Property Ident As %String;
Index ProductId On (Department, Ident) [ IdKey, Unique ];
Property Name As %String;
Index Name On Name;
Property Type As %String(DISPLAYLIST = ",Sveže,Zmrznjeno,Dodelava", VALUELIST = ",FRE,FRO,FIN");
Property CUsInTU As %Integer;
Property NominalWeightCU As %Numeric;
Property WeightClassCU As %String;
Storage Default
{
<Data name="ProductDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Name</Value>
</Value>
<Value name="3">
<Value>Type</Value>
</Value>
<Value name="4">
<Value>CUsInTU</Value>
</Value>
<Value name="5">
<Value>NominalWeightCU</Value>
</Value>
<Value name="6">
<Value>WeightClassCU</Value>
</Value>
</Data>
<DataLocation>^MasterData.ProductD</DataLocation>
<DefaultData>ProductDefaultData</DefaultData>
<IdLocation>^MasterData.ProductD</IdLocation>
<IndexLocation>^MasterData.ProductI</IndexLocation>
<StreamLocation>^MasterData.ProductS</StreamLocation>
<Type>%Storage.Persistent</Type>
}
XData RotorDataMapping
{
<Mapping xmlns="http://www.intersystems.com/jsonmapping">
<Property Name="Ident"/>
<Property Name="Name"/>
<Property Name="Type"/>
</Mapping>
}

I would like the property Type to be exported (%JSON.Export("RotorDataMapping") method) with display member rather than value member.

Regards,
Matjaž

Matjaz Murko · May 3, 2022 go to post

Sorry, my mistake. JSON_OBJECT should parse %TimeStamp value to ISO 8601 format, but it doesn't. So my question is how to do it...

Regards,
Matjaž

Matjaz Murko · May 3, 2022 go to post

Hi.

I've already tried it, but with no success. But I recently upgraded IRIS to the newest version and it works.

Tnx.

Regards,
Matjaž

Matjaz Murko · Apr 12, 2022 go to post

Hi.

Try this:

select convert(varchar,dateadd(ss,avg(datepart(hour,timeSpent)*3600+datepart(minute,timeSpent)*60+datepart(second,timeSpent)),0),108) from myclass

Regards,
Matjaž

Matjaz Murko · Jan 9, 2022 go to post

Hi.
I've used Cache/IRIS Native Provider, but recently I'm moving all my apps to REST. It is OS/IDE independent and commonly used. Cache/IRIS REST API services are very efficient and very easy to use. Recommended.

Regards, Matjaž.

Matjaz Murko · Jan 4, 2022 go to post

Hi.

Have you tried:
Property radiusmean As %Numeric(SCALE = 5);

Regards, Matjaž

Matjaz Murko · Dec 23, 2021 go to post

Hi.

I'm using IRISProviderCore21.dll in my .NET 5 apps and it's working fine.

Regards,
Matjaž

Matjaz Murko · Nov 2, 2021 go to post

Hi.
Have you tried:

Set time15min=$SYSTEM.SQL.Functions.DATEADD("mi",-15,$ZDateTime(now,3))

Regards,
Matjaž

Matjaz Murko · Nov 2, 2021 go to post

Hi.
Tnx for your reply. I'm doing some research/testing with WebSocket to achieve wanted functionality.

Regards,
Matjaž

Matjaz Murko · Oct 4, 2021 go to post

That's the way the proxy classes are  functioning (caching). But in new Native API for IRIS there are no proxies, just class methods/functions are called from app and I think, it should be pretty the same as calling this methods/functions from terminal window.

Matjaz Murko · Oct 3, 2021 go to post

Hi.

As I've mentioned in previous post I'm using workaround, but I think it's a bug in API, because the same method works fine in terminal window without explicite set the objects to null (all used objects are released and consequently all locks are released also - expected behaviour in class with procedure block enabled).

Regards,
Matjaž

Matjaz Murko · Oct 2, 2021 go to post

I'm setting all referenced instances to null in COS to release locks as workaround. But I'm not sure it is a bug or expected behaviour...

Matjaz Murko · Sep 29, 2021 go to post

I'm not using IRISObjects, just ClassMethodString:

PersonData = JsonSerializer.Deserialize<PersonDataClass>(App.Iris.ClassMethodString("API.Calls.Operative", "Checking", CardNo.Text));
            if (PersonData != null)
            {
                if (!PersonData.IsValid)
                {
                    SystemSounds.Exclamation.Play();
            }

Matjaz Murko · Sep 29, 2021 go to post

Hi.
Tnx for reply.
Regardless that I'm using ProcedureBlock, Native API calls to class methods do not put instances out of scope (and consequently do not release locks).
Regards, Matjaž.

Matjaz Murko · Sep 29, 2021 go to post

I do not know if it is important, but I'm using abstract class. And although I explicitly add ProcedureBlock  to the class definition it doesn't help when I'm calling the method with Native API...

Matjaz Murko · Sep 29, 2021 go to post

These are my findings:
- class has ProcedureBlock enabled by default,
- if I run the class method from terminal window, it behaves as a procedure block,
- if I run it from IRIS Native API (C# app) then it behaves as non procedure block and I have to set person & checking instances to null to release the lock.

Matjaz Murko · Sep 29, 2021 go to post

Hi.

Tnx for your quick reply.

Here is the class method:

ClassMethod Checking(CardNo As %String) As %String [ Language = objectscript ]
{
Set person=##class(MasterData.Person).CardNoOpen(CardNo,4)
Quit:person="" "null"
Set checking=##class(Production.Checking).%New()
Set checking.Person=person
Set checking.Condition.Type=person.Condition.Type
Set checking.Condition.ValidBy=person.Condition.ValidBy
Set checking.ConditionIsValid=(person.Condition.ValidBy>=+$Horolog)
Do checking.%Save()
Set model=##class(API.Models.Operative.PersonGetData).%New()
Set model.Ident=person.Ident
Set model.FirstName=person.FirstName
Set model.LastName=person.LastName
Set model.Department=person.Department.Name
Set model.IsValid=checking.ConditionIsValid
If ('checking.ConditionIsValid)
{
Set person.Condition.Type="T"
Set person.Condition.ValidBy=+$Horolog+6
Do person.%Save()
}
Do model.%JSONExportToString(.json)
Do ##class(MasterData.Person).%UnlockId(person.%Id())
Quit json
}

I'm using now %UnlockId method instead of setting the object to null.

Regards,
Matjaž

Matjaz Murko · Aug 20, 2021 go to post

Hi.

I'm looking for an example on client side in C# (Xamarin)...

Regards, Matjaž.

Matjaz Murko · Aug 13, 2021 go to post

Hi.

I want to use Native SDK for Java to call class methods.

Regards, Matjaž

Matjaz Murko · Aug 5, 2021 go to post

Hi.

Try this:

set RNumber="100"

set RowResult=0,Power=1

for i=$LENGTH(RNumber):-1:1 {
        set RowResult = RowResult + ($EXTRACT(RNumber,i)* Power)
        set Power = Power * 2

}

Regards,

Matjaž

Matjaz Murko · Jul 18, 2021 go to post

Hi.

It means that you make for every property you want do get from IRIS a call to IRIS server?

Regards,

Matjaž