Question Nezla · Jun 1, 2022

Hi Guys,

I have a service that picks up jobs and process them, is there a way that I can cap the number of attempts to pickup a certain job eg. 10 times if no response then just discard ? 

Thanks

1
0 236
Question Nezla · May 30, 2022

Hi Guys,

I'm using the below code to post a JSON file:

 FilePath="D:\Allied_InterfaceData\ResponseFiles\CollectionData\CollectionGood\CollectionGood_9503948.json"
 Set File = ##class(%File).%New(FilePath)
Do File.Open("R")
  Set Httprequest=##class(%Net.HttpRequest).%New()
Set Httprequest.SSLConfiguration="RTLS"
Set Httprequest.Server="vibra-api-dev.azurewebsites.net"
Set Httprequest.Timeout=30
Set Httprequest.Https=1
set Httprequest.ContentType="application/json"
Do Httprequest.SetHeader("Accept","*/*")
  Do Httprequest.SetHeader("Authorization","Bearer "_^Token)
 While ('File.

3
0 626
Question Nezla · May 28, 2022

Hi Guys,

how can I write a json file in httprequest, I'm using the below but when I check what's in mystring it's actually truncated and doen't include all my file?

 Set stream=##class(%FileBinaryStream).%New()
    FilePath="D:\Allied_InterfaceData\ResponseFiles\CollectionData\CollectionGood\CollectionGood_9431312.json"
   Set File = ##class(%File).%New(FilePath)
Do File.Open("R")
Set Line = File.Read(1000)
While (File.Read(1000)'="") { S mystring=mystring_File.Read(1000)
} 
  Set Httprequest=##class(%Net.HttpRequest).%New()
Set Httprequest.SSLConfiguration="RTLS"
Set Httprequest.

10
0 581
Question Nezla · May 27, 2022

Hi Guys,

I've a JSON file and I'm using the below code to post it but I'm geting "HTTP/1.1 415 Unsupported Media Type" error, could help pls? 

 Set RootMIMEPart=##class(%Net.MIMEPart).%New()      
     Set BinaryMIMEPart=##class(%Net.MIMEPart).%New()
     Set contentdisp="form-data; name="_$CHAR(34)_"file"_$CHAR(34)_"; filename="_$CHAR(34)_""_$CHAR(34)
     Do BinaryMIMEPart.SetHeader("Content-Disposition",contentdisp)
     Set stream=##class(%FileBinaryStream).%New()
     Set stream.Filename=FilePath
     Do stream.LinkToFile(FilePath)      Set BinaryMIMEPart.Body=stream
    Do BinaryMIMEPart.

4
0 488
Question Nezla · May 26, 2022

Hi Guys,

I had a record with name field has a uniqueKeyIndex, so because I couldn't change and update the name description using SQL, I went and changed the name description in the Globals and removed the Index on name with old description, but now I wanted to create a new record with the old description that I removed from Globals but I'm getting UniqueIndex error, which means the old description is still somewhere in one of the globals, but I can't find that record anywhere in both data or index globals ?

 

thanks

3
0 417
Question Nezla · May 24, 2022

Hi Guys,

I'm using the below so I can put JSON file in an object and read each property:

  ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(JSONString3,,.list)
 S Job= list.jobGUID

but because the JSON starts and ends with [ ] my list is empty, and I had to remove them to get a good list.

So is there a way that I can handle this which having me removing those brackets each time, because I thought %ConvertJSONToObject to be able to handle this anyway?

7
0 454
Question Nezla · May 22, 2022

Hi Guys,

I'm running Ensemble 2014 and I'm using this to convert JSON to object:

class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject

 but how can I convert to %CharacterStream because I'm saving a %CharacterStream field

Thanks

1
0 372
Question Nezla · May 22, 2022

Hi Guys.

I'm a newbie in productions and services and I'm using this code to get HTTP response with JSON file, is a way to do this via a production service?

set Httprequest ##class(%Net.HttpRequest).%New()
  Set Httprequest.SSLConfiguration="RTLS"                              
  Set Httprequest.Server="serverurl"                 
  Set Httprequest.Https=1
  Set Httprequest.Timeout=30
  Token="sometoken_value"
   set Httprequest.ContentType="application/json"
Do Httprequest.SetHeader("Accept","application/json")
Do Httprequest.SetHeader("Authorization","Bearer "_Token)
   set tSc = Httprequest.

2
0 280
Question Nezla · May 17, 2022

Hi Guys,

How do I create a JSON with the below structure pls:

{
  "field 1": "123",
  "field 2": "1.1.1",
  "field 3": "4.428",
   "Lines": [
    [ 0.00523, 0.00952, 0.01626 ],
    [ -0.00303, -0.00286, 0.00387 ],
    [ 0.00110, 0.00814, 0.00800 ],
    [ -0.00991, 0.00952, 0.00800 ]
  ]
}

thanks

2
0 373
Question Nezla · May 16, 2022

Hi Guys,

I currently have a service that uses an InboundAdapter to get a JSON file and process it given that the client is pushing data to us, but now we have another client where we need to request the JSON file by sending a HTTP request then get the file and process it, kind of a Get rather than push, how can I create a service that handle that?

Thanks

1
0 365
Question Nezla · May 15, 2022

Hi Guys,

How do I add another tablepane or gridview to make my tablepane look like expandable and collapses back as in the below pic?

so basically I would like to add a child tablepane or gridview for each row that populate the related details for it.

thanks

1
0 251
Question Nezla · May 8, 2022

Hi Guys,

I've a Production Service that receives a CharacterStream and save it in a Global, then a second classmethod that pick up that CharacterStream from the global and process it, but for some reason it fails when i comes  Set HTTPURL = $ZCVT($G(pInput.Attributes("URL")),"U") which error saying "INVALID OREF", as I checked it seems that pInput is has a CharacterStream but not sure why is says invalid Object ref (see attached)?

Method OnProcessInput(pInput As %CharacterStream, Output pOutput As %CharacterStream) As %Status
{
   Set pOutput=##class(%GlobalCharacterStream).

2
0 341
Question Nezla · May 7, 2022

Hi Guys,

we have a class with over 24 million records and despite indexes querying is still slow, so we are looking to create a copy or clone of our current class have an scheduled task that runs every night or month, copy old records this new clone (eg. from last month)   and remove old them from our current class.

6
0 600
Question Nezla · May 7, 2022

Hi guys,

How do I create a make a http request using curl, I've found samples on how to do it from a command prompt but how to create and make a http post request and get a response with ensemble object and functions?

I guess somthing like :

s req=##class(%Net.httpRequest).%New()

...etc

Or do I build a command run it in ensemble and get a response back, if so how can I do that ?

Thanks

2
0 697
Question Nezla · May 4, 2022

Hi Guys,

How do I do a HTTP post request using a curl and get a response, the response should be a JSON file ? a sample code would be really appreciated.

Thanks

4
0 518
Question Nezla · Apr 27, 2022

Hi guys,

We have created a utility to allow users to create a System task for a list of items the same way it’s done via SMP (attached below), the problem is that there may items and those systems tasks will grow a maybe exceed a couple of thousands so :

  • First, what the maximum of scheduled system tasks we can have ?
  • Then, is there a better way we can do this without having a big list of system tasks ?
1
0 301
Question Nezla · Apr 26, 2022

Hi guys,

I have a %Time filed with (Format=1) to allow showing hh.mm.ss and the field is showing fine in display mode eg:

 

it should show 00:07:30  but the seconds are cut off from it as below :

any ideas pls?

thanks

8
0 342
Question Nezla · Apr 18, 2022

Hi Guys,

I know that there a way to view global content from the Terminal rather the SMP but I can't remember the command, I think it's something like D ^Global or something !?

Thanks

6
0 787
Question Nezla · Apr 15, 2022

Hi Guys,

I'm using the below code to export to excel and it's working fine for one client but not for another and both clients are running the same version of IE 11.

for the second client the code generates an empty xlsx file and when I try to open it it says file corupted although data exits in the resultset, so is there a flag or setting needs be done in the client server or IE?    

Class MSDS.UI.Serenity.Report.ExcelExport Extends %ZEN.Report.

1
0 378
Question Nezla · Apr 12, 2022

Hi Guys,

I'm using  seconds counter then save those seconds in a field defined as string where eg. I do :

S time=30  

S time = $zt(time,1)  

Update myclass se timeSpent = :time

which now shows up as 00:00:30 if I do an sql query which good but the problem if I run a query to get average timeSpent I get 00:00.

having the field defined as integer would allow selecting avg but running a query in my Zen page wouldn’t show me a time format

so how can I get an average on my a filed defined as string in a sql query?

thanks

11
0 496
Question Nezla · Apr 10, 2022

Hi Guys,

I'm a bit confused where if I run a query trough SMP I don't get any result which should be true but if I run the same query from a classmethod I get a query result which shouldn’t be even if I pass any gibberish parameter into my class method because I'm sure there should be any data? see attached  

Thanks 

7
0 381
Question Nezla · Apr 6, 2022

Hi Guys,

I've the below tablePane and for some reason when it's populated always the last row is selected by default, I've many tablePanes defined the same way but none of them has the last row selected when populate, so not sure why this grid is doing this?

3
0 320
Question Nezla · Mar 24, 2022

Hi Guys,

Can I insert a new row and enforcing my own ID not the default id increment? 

 &sql(INSERT INTO Sample.Person 
    (ID,Name,SSN) 
    VALUES ('205','Swift,Jonathan','111-22-3333'))

 IF (SQLCODE = 0) {
     Write "New Person inserted with ID: ", %ROWID,!
 }
 else
 {WRITE !,"SQLCODE=",SQLCODE," ",%msg }

I tried this in samples and got the below error:  

SQLCODE=-111 INSERT of Default Only RowID Field 'ID' in table 'Sample.Person' not allowed
 

thanks

1
0 418
Question Nezla · Feb 15, 2022

Hi Guys,

I've the below query that selects the existing processes with dates & times and it working fine, but in case of records with the same processedDate I would like to only get the latest based on processedTime field?

2
0 468