go to post Eduard Lebedyuk · Nov 14, 2019 Yes, try this instead (in adaptor): Method OnTask() As %Status { Set sc = ##super() // all rows were just processed // add your logic here If '$IsObject(..%CurrResultSet) { Set ^dbg($i(^dbg)) = "Last row" } Quit sc } Worked for me.
go to post Eduard Lebedyuk · Nov 13, 2019 It all depends on your locale. In RUSW for example UTF8 is the default, bit not in English locales. You can also use ^NLS to check/modify the defaults.
go to post Eduard Lebedyuk · Nov 13, 2019 You can use both: [ SqlComputeOnChange = (%%INSERT, %%UPDATE) ]
go to post Eduard Lebedyuk · Nov 13, 2019 You can change the charset by setting this global: set ^%SYS("CSP","DefaultFileCharset")="utf-8"
go to post Eduard Lebedyuk · Nov 10, 2019 Do you want for each Movie object (row) to guarantee that it's Actors property would be unique (containing only distinct Actors)? Or is it something else? Can you show us examples of correct and incorrect Movie records?
go to post Eduard Lebedyuk · Nov 7, 2019 Some questions/notes: 1. Why are you not using relationships? 2. If you have an object, which references another object in a property and you save a base object all it's properties-objects are also saved automatically. Have you thought about setting all references before save and after that only calling %Save() once? 3. I'd really recommend against relying on auto-incremental ID matches. They are NOT guaranteed to be equal. 4. The answer to your original question depends on where the failure was. %OnAfterSave is in transaction and is rolled back. However $Increment used to get hew IDs is not rolled back (as per documentation).
go to post Eduard Lebedyuk · Nov 5, 2019 If you want it stored, make it triggered computed like this: Property LabCode As %Library.String(MAXLEN = 64) [ SqlColumnNumber = 5, SqlComputeCode = { set {*}= $EXTRACT({LabName},0,3)_" "_{LabID}}, SqlComputed, SqlComputeOnChange = LabName ]; Docs. Note that it wouldn't recalc LabCode values for existing rows. If you need that, trigger recalculation with trivial update.
go to post Eduard Lebedyuk · Nov 5, 2019 Use {%%ID}. Here's an example: Class util.Calc Extends %Persistent { Property calc As %String [ Calculated, SqlComputeCode = {set {*} = {%%ID}}, SqlComputed ]; /// do ##class(util.Calc).Test() ClassMethod Test() { set obj = ..%New() set sc = obj.%Save() do ..AllFunc().%Display() } Query All() As %SQLQuery { SELECT * FROM util.Calc } } Calling: do ##class(util.Calc).Test() Returns: ID calc 1 1 Docs.
go to post Eduard Lebedyuk · Nov 4, 2019 That would work storagetime but not at runtime. I think runtime hook disallowing duplicate inserts would be better. To OP. Age seems like a strange property to store in your use case. It's better to store DoB I think.
go to post Eduard Lebedyuk · Nov 1, 2019 There are many ways to do what you need. Copy CACHE.DAT / IRIS.DAT Export globals and code Use ASYNC mirror or backup Here's the questions you need to answer to choose the best path: Is downtime OK or not? Do you need a whole database or some part? What's the size of your DB? Are there mirrors/backups available? Are your code/data in separate DBs? Do you need to run the pipeline once or do you need to stay somewhat up to date?
go to post Eduard Lebedyuk · Oct 30, 2019 Some info about upcoming AI/ML webinar. Only a week left to register!
go to post Eduard Lebedyuk · Oct 28, 2019 What value are you expecting? Base64 is often used to encode hashes: write ##class(%SYSTEM.Encryption).Base64Encode(##class(%SYSTEM.Encryption).MD5Hash("f...@baz.com"))
go to post Eduard Lebedyuk · Oct 25, 2019 You need to create a class, for example. Test.EnsUtils, in it add this class method. After that execute the query above (name of the sql procedure would be Test.EnsUtils_ItemStatuses)
go to post Eduard Lebedyuk · Oct 24, 2019 You'll need a SQL procedure to return status. I haven't found it already SQL enabled. ClassMethod ItemStatuses(pName, pIsRunning, pEnabled, pID) As %String [ CodeMode = expression, SqlProc ] { ##class(EnsPortal.Utils).ItemStatuses(pName, pIsRunning, pEnabled, pID) } After that just query Ens_Config.Item: SELECT ID, ClassName, Name, Enabled, ItemStatuses(Name, 1, Enabled, Id) Status FROM Ens_Config.Item Parameter pIsRunning means a running production. Procedure returns comma-separated info about host status and io status.