go to post Rochdi Badis · May 27, 2022 Not 100% sure but I think it should be a JSON format so how can I change my code for JSON? sorry I'm a newbie, what do you mean encoding are referring to "text/plain" or "application/JSON" for example? Thanks
go to post Rochdi Badis · May 26, 2022 So in the future and in case I really need create a record with the same description on a unique indexed field, can I remove the UniqueIndex definition from the class definition do my change then put it back and compile rather than doing it through globals? also when rebuilding indexes from SMP, it says running at the background but there no notification when the rebuild has finished, is there a way to see the running process because I couldn't see it in Processes? Thanks
go to post Rochdi Badis · May 24, 2022 Hi Julius, Pls ignore my last message, I was just trying to attach a file to my message but didn't work. Thanks
go to post Rochdi Badis · May 24, 2022 what I sent is just a part of the full JSON as an example so it's not because it's missing part of it here is the full string, where I had to remove the brackets from beginning and end JSON [{"routeGuid":"531318d8-9967-445a-ae42-14e04244e0fb","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-20T23:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"0b955ee7-9a54-4b13-9af1-7019721faeab","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"8f9e85ab-31e7-4835-8969-6d72d142a2f1","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"68cea9d3-54cd-43f2-ae37-aaf47ed43e6b","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"7602764e-8951-451f-9653-ceb84834a1a6","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"8c9d66f8-b6ff-4eba-9529-c4aec6443751","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-20T15:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"88d2e472-a1e4-40b3-a108-f2d32a2023e5","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"116f2ac6-da5f-46da-a7c7-92d9eaf98c89","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"a878e527-f519-4aaa-bf5d-0d65f72de119","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"be570b14-0555-4b86-ab9f-e37c40c79216","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"2c661016-ebbd-4f26-b8e0-1ef63dc0b473","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-20T07:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"3a13e243-d6ed-4788-98b2-52e9213bee00","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"54969869-c4f6-43f6-a74a-2a67f9a73fc5","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"700af7d3-77b3-4a84-ba11-ea49602d6558","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"18dc3370-c291-468b-af1f-0361d95bb02c","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"8e11ea63-be68-4283-91a3-6586eb1172b3","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-19T23:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"35d0d2e7-1199-4c18-8941-4fff6dbdba1f","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"8044560c-94d2-4da7-87f5-07328d9e62c1","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"b636a2f5-d35f-4c82-9646-e09572336e23","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"9c9a4bf4-e8af-4b8d-9de2-a99cdff150ed","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"b8e5e096-c9bc-41c5-a1af-713301cb7545","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-19T15:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"a576d235-6eb6-4312-a1ff-7b1f767b88ce","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"654cf21e-daad-4a11-b676-86a7bc8a3360","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"2be4efc8-6616-4bff-87ba-30fe388a1b34","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"a5374d6c-311c-44d0-8d06-3a31f33dd3a8","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"9ea2968a-8deb-480c-9591-ffa18760b87f","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-21T07:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"955529c5-36be-4f3e-b768-0e3b377804a7","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"60a7cdb0-499e-4d02-b4d3-06ee58e40481","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"e84eda78-1491-49af-9e34-d647e817a251","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"9bcd5fe6-6f05-4482-ad78-612f35c60b41","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000}]}]
go to post Rochdi Badis · May 18, 2022 Nope, changed it to */* and didn't make any diffrence. in the Token there are "." & "_" special charachters not sure if that cause problem, I tried removed them but still no luck.
go to post Rochdi Badis · May 17, 2022 mybe you mean this d ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(SampleJsonData,,.list) ,I tried that but I got an empty list? in all cases, after doing the below, I should be able at lease read the JSON string but I'm getting an html file, so I'm missing something in my code? set Httprequest = ##class(%Net.HttpRequest).%New() Set Httprequest.SSLConfiguration="RTLS" Set Httprequest.Server="serverurl" Set Httprequest.Https=1 Set Httprequest.Timeout=30 set Httprequest.ContentType="application/json" Do Httprequest.SetHeader("Accept","text/plain") set Httprequest.Username="user" set Httprequest.Password="password" S stat= Httprequest.Get("someurl") Set Resp=Httprequest.HttpResponse.Data.Read()
go to post Rochdi Badis · May 17, 2022 So I did the following from the Terminal: set Httprequest = ##class(%Net.HttpRequest).%New() Set Httprequest.SSLConfiguration="RTLS" Set Httprequest.Server="serverurl" Set Httprequest.Https=1 Set Httprequest.Timeout=30 set Httprequest.ContentType="application/json" Do Httprequest.SetHeader("Accept","text/plain") set Httprequest.Username="user" set Httprequest.Password="password" S stat= Httprequest.Get("someurl") W stat1 so given the status =1 that means everything went ok isn't if not how can I check? then I did the following to read the JSON file : Set Resp=Httprequest.HttpResponse.Data.Read() but when I cheked what's in Resp I get the below html output: <!DOCTYPE html><html><head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <title>IUDEX</title> <base href="/" /> <link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" /> <link href="_content/Smart.Blazor/css/smart.default.css" rel="stylesheet" /> <link href="css/app.css" rel="stylesheet" /> <link href="Galaxy.Client.styles.css" rel="stylesheet" /></head><body> <style> .loader-logo { width: 256px; } .loader-container { flex-direction: column; flex-wrap: nowrap; justify-content: center; align-items: center; display: flex; gap: 32px; height: 512px; } .spinner { border: 5px solid #afafaf; border-top: 5px solid #e53947; border-radius: 50%; width: 32px; height: 32px; animation: spin 700ms linear infinite; } @keyframes spin { 0% { transform: rotate(0deg) } 100% { transform: rotate(360deg) } } </style> <div class="loader-container" id="app"> <img class="loader-logo" src="images/logo-dark.svg" /> <div class="spinner"></div> <div id="blazor-error-ui"> An unhandled error has occurred. <a href="" class="reload">Reload</a> <a class="dismiss">ð</a> </div> </div> <script src="_content/MudBlazor/MudBlazor.min.js"></script> <script src="_content/Smart.Blazor/js/smart.blazor.js"></script> <script src="_content/Smart.Blazor/js/smart.elements.js"></script> <script src="_content/Galaxy.DataViewer/canvasjs.min.js"></script> <script src="_framework/blazor.webassembly.js"></script> <script src="js/galaxyLib.min.js"></script> </body></html> I thought I'll be getting a JSON string, FYI I'm supposed to a get a Token in a JSON file? Thanks
go to post Rochdi Badis · May 17, 2022 sorry also set obj = {}.%FromJSON(req.HttpResponse.Data) is not working, is this available in Ensemble 2014? Thanks
go to post Rochdi Badis · May 17, 2022 Hi Set jsonObject={}.%FromJSON(jsonString) doesn't seems to work and couldn't find %FromJSON in Docs is this available in Ensemble 2014 which I'm using? thanks
go to post Rochdi Badis · May 15, 2022 Sorry guys for the delay but it has been a busy week. basically, this is the query I'm using and attached is a file with the classes used: Select distinct kc.id,MSDS_UI_Serenity_Report.KitContentMissingType16_FindSerialNo(i.id,kc.id,9237,'00007SV3') As SerialNo, CASE WHEN i.Code IS NOT NULL THEN i.Code ELSE ' ' END As Code, MSDS_UI_Serenity_Report.KitContentType3_GetGroupedName(i.Name,kc.GroupFlag,kc.SubGroupFlag) As InstName, kc.Quantity as Qty,MSDS_UI_Serenity_Report.KitContentMissingType12_GetContentRemarks(k.Loc,k.id,kc.id,'00007SV3') As ContentRemarks, kc.GroupCount As GroupCount, g.Name As grp, MSDS_UI_Serenity_Report.KitContentMissingType16_Getpck(i.id,'00007SV3',kc.Quantity,kc.id,kc.kitId) As pck, MSDS_UI_Serenity_Report.KitContentMissingType15_GetDecon(kc.id,5) As decon, MSDS_UI_Serenity_Report.KitContentMissingType16_GetComments(i.id,kc.id) As Comment, MSDS_UI_Serenity_Report.KitContentMissingType16_GetReason(i.id,kc.id) As Reason, MSDS_UI_Serenity_Report.KitContentMissingType16_GetRemarks(i.id) As Remark From MSDS_Serenity.KitContent kc, MSDS_Serenity.Kit k, MSDS_Serenity.InstrumentGroup g, MSDS_Serenity.Instrument i, MSDS_Serenity.CustomInstrument ci where i.active = 1 and (i.IsImplants is null or i.IsImplants!=1) and kc.instrument = i.id and i.groupid = g.id and k.id = kc.kitid and k.Loc = 5 and k.id = 9237 order by kc.Position,i.Name usedclassesdef.zip although all the fields used are indexed but still this sample query takes around 1 min & 40 sec to generate 48 records and some other queries with more records could take around 10 mins. I noticed, that most time is consumed and heavy processing is in class calls in the query : Eg. MSDS_UI_Serenity_Report.KitContentMissingType16_FindSerialNo around 40 sec but I’ve created and built indexes for all used fields (through SMP)!? Thanks
go to post Rochdi Badis · May 5, 2022 Sorry this is just too vague, and sort of result I got from googling around, I'm new to this and I was after a just a quick sample using ensemble objects on how to create a Post HTTP request and where to include my curl, then send the request ..etc Thanks
go to post Rochdi Badis · Apr 27, 2022 Thanks you very much Vitaliy this worked: select TO_CHAR(avg(PackingTimeSpent),'HH24:MI:SS') average from MSDS_Serenity.KitlabelAssoc where label='00007IT4' Thanks
go to post Rochdi Badis · Apr 27, 2022 Thanks again Vitaliy but we still going on cycles 😊 as I already you examples and I send you the a screenshot with the result and still not working, maybe I'm missing what you trying to say but I already tried option 1 with Timeformat=1 for the avg and didn't work. your solution 1 or 2 works fine if querying the required field but not with avg, so eg. select %external(CAST(+avg(166.38) as TIME)) didn't work for me, maybe as you mentioned it's treating as double with floating precision that why it's cutting off the seconds, you mentioned the example above and I'm not sure to which one are youi refering to with so many replies, so can you point me to which one exactly because select %external(CAST(+avg(166.38) as TIME)) wouldn't work? Thanks
go to post Rochdi Badis · Apr 26, 2022 Thanks Vitaliy, you answers has been very helpful in many ways, but as you can see I've tried options from your simple sample with the queries you provided but it came up empty as attached, could it be the Ensemble version 2014? Thanks
go to post Rochdi Badis · Apr 26, 2022 Sorry guys but still no luck, + or 0+ doesn't get anything as below (same in my Zen page) FYI, here is the property definition: Thanks