go to post Timothy Leavitt · Aug 22, 2016 You can pass a stream to $fromJSON instead of a string: USER>set tStream = ##class(%Stream.TmpCharacter).%New() USER>d tStream.Write("{""a"":2}") USER>s obj = {}.$fromJSON(tStream) USER>w obj.a 2 In your case: Set RequestObj = ##class(%Object).$fromJSON(%request.Content) This is much easier than reading the stream into a string first, and avoids <MAXLENTH> issues.
go to post Timothy Leavitt · Aug 16, 2016 If you're talking about storing dynamic data along with the session, see the documentation on %session.Data. This is just a multidimensional property - so you can do something like: Set %session.Data("hello","world")=15 And then reference that data in a request later in the same session. For a more advanced approach - for example, if there's a large amount of data related to the session - you could use one or more tables instead, and clear data when appropriate by implementing OnEndSession in a subclass of %CSP.SessionEvents and configuring that class as the session events class for your web application (in the web application's security settings).
go to post Timothy Leavitt · Aug 11, 2016 As written, the code in your post should work fine.If the parameter '1' is actually a COS variable name, then the "undefined" would be expected (since the variable with that name is not defined in JavaScript), and you could use something like:&js<zenPage.doReturn(#(..QuoteJS(myVariableName))#);>
go to post Timothy Leavitt · Jul 21, 2016 Here's the documentation on about configuring/implementing source control in Studio: http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...
go to post Timothy Leavitt · Jul 21, 2016 Here's some documentation that might be helpful (if you're looking for a better solution): Packaging DeepSee Elements into Classes It's also possible to export .DFI files directly with $System.OBJ.Export and reload with $System.OBJ.Load, same as with classes/routines. Back to your actual question - what do you mean by "source code of a dashboard in udl format"? If you mean a file containing the same XML you see in Studio - e.g.: <?xml version="1.0"?> <pivot xmlns="http://www.intersystems.com/deepsee/library" name="test2" folderName="" title="" description="" keywords="" owner="" shared="true" public="false" locked="false" resource="" timeCreated="2016-07-21T12:43:26.593Z" createdBy="tleavitt" category="" bookCover="" mdx="" cellWidth="120" columnHeaderStyle="" rowHeaderStyle="" cellStyle="" rowLabelSpan="true" columnLabelSpan="true" cellHeight="22" showEmptyRows="false" showEmptyColumns="false" cubeName="" caption="" listing="" listingRows="" showStatus="true" pageSize="100" colorScale="" rowTotals="false" columnTotals="false" rowTotalAgg="sum" columnTotalAgg="sum" rowTotalSource="page" showZebra="false" showRowCaption="true" printTitle="" printSubtitle="" printSubtitleOn="" showUser="" printPageSize="" printOrientation="" printMarginTop="" printMarginLeft="" printMarginRight="" printMarginBottom="" printLabelWidth="" printCellWidth="" autoExecute="true" manualMode="false" userMDX="" chartMarginTop="" chartMarginLeft="" chartMarginRight="" chartMarginBottom="" maxRows="" borderLeftCell="" borderRightCell="" borderTopCell="" borderBottomCell="" borderLeftCol="" borderRightCol="" borderTopCol="" borderBottomCol="" borderLeftRow="" borderRightRow="" borderTopRow="" borderBottomRow="" fontFamilyCell="" fontSizeCell="" fontFamilyCol="" fontSizeCol="" fontFamilyRow="" fontSizeRow="" showFilters="" showListingFilters="" showDate="" listingFontSize="" showZebraStripes="" filterTableStyle="" filterTableCaptionStyle="" filterTableItemStyle="" nowDisplayFormat="" measureLocation="" hideMeasures="" backgroundImage="" backgroundOpacity=".12"> <rowAxisOptions spec="" key="" value="" text="" headEnabled="true" headCount="" filterEnabled="true" filterExpression="" orderEnabled="false" orderExpression="" orderDirection="BDESC" aggEnabled="false" aggFunction="" aggFunctionParm="" levelCaption="" levelFormat="" levelSummary="" levelType="" drillLevel="0" advanced="false" levelStyle="" levelHeaderStyle="" suppress8020="false" drilldownSpec="" enabled="true"> </rowAxisOptions> <columnAxisOptions spec="" key="" value="" text="" headEnabled="true" headCount="" filterEnabled="true" filterExpression="" orderEnabled="false" orderExpression="" orderDirection="BDESC" aggEnabled="false" aggFunction="" aggFunctionParm="" levelCaption="" levelFormat="" levelSummary="" levelType="" drillLevel="0" advanced="false" levelStyle="" levelHeaderStyle="" suppress8020="false" drilldownSpec="" enabled="true"> </columnAxisOptions> </pivot> You could import it using %DeepSee.UI.FolderItemDocument: Class User.DFIImport { /// Example use: /// Do ##class(User.DFIImport).ImportDFIXML("foldername-itemname.pivot.DFI","C:\Temp\somefile.xml") ClassMethod ImportDFIXML(pName As %String, pFilename As %String) As %Status { Set tSC = $$$OK Try { set tStream = ##class(%Stream.FileCharacter).%New() set tSC = tStream.LinkToFile(pFilename) If $$$ISERR(tSC) { Quit } set tDoc = ##class(%DeepSee.UI.FolderItemDocument).%New(pName) set tSC = tDoc.ImportFromXML(tStream) If $$$ISERR(tSC) { Quit } set tSC = tDoc.Save() If $$$ISERR(tSC) { Quit } } Catch e { Set tSC = e.AsStatus() } Quit tSC } } Note that the name specified for the %DeepSee.UI.FolderItemDocument will overwrite the "name" and "folderName" in the XML.
go to post Timothy Leavitt · Jul 20, 2016 If you're running on Caché 2016.1, the new JSON/Dynamic Object capabilities might help - see: https://community.intersystems.com/post/introducing-new-json-capabilitie...
go to post Timothy Leavitt · Jul 14, 2016 Another option might be "View Other":If ClassA generates ClassB and sets GeneratedBy = ClassA.CLS, then ClassB will show up under "View Other" for ClassA. (Studio works the same way.)
go to post Timothy Leavitt · Jul 10, 2016 This is a good use case for HAVING. Using Sample.Person as an example, the following queries are equivalent: SELECT a.Age,A.Name FROM Sample.Person a LEFT JOIN Sample.Person b on a.home_state = b.home_state and a.DOB < b.DOB WHERE b.ID is null Implemented with HAVING: SELECT Age,Name FROM Sample.Person GROUP BY Home_State HAVING Age = MIN(Age) The second is much more intuitive, and runs significantly faster too. I suspect your query would be expressed as: SELECT * FROM client_address GROUP BY client_id HAVING date_updated = MIN(date_updated)
go to post Timothy Leavitt · Jun 17, 2016 The business operation's "Archive I/O" setting might do what you want, depending on what messages you're passing around. This will add some extra things to the message trace showing what the input to services or the output from operations is.You can enable I/O archiving in the business operation's settings on the production configuration page, at the end of the "Development and Debugging" section.
go to post Timothy Leavitt · Jun 16, 2016 Your last example is really close - probably just the typo in the component ID that's the problem. Class DC.ZenRadioOnLoad Extends %ZEN.Component.page { /// This XML block defines the contents of this page. XData Contents [ XMLNamespace = "http://www.intersystems.com/zen" ] { <page xmlns="http://www.intersystems.com/zen" title=""> <radioSet id="appRadio" name="appRadio" displayList="App One,App Two,App Three" valueList="One,Two,Three" /> </page> } /// This callback is called after the server-side page /// object and all of its children are created.<br/> /// Subclasses can override this to add, remove, or modify /// items within the page object model, or to provide values /// for controls. Method %OnAfterCreatePage() As %Status { Set ..%GetComponentById("appRadio").value = "Three" Quit $$$OK } }
go to post Timothy Leavitt · Jun 14, 2016 You could always use process private globals instead of local variable names if you want to avoid collisions in local variable names. ClassMethod GetVariables() As %List { Set ^||VariableNameList = "" Set ^||VariableName = "" Set ^||VariableName = $Order(@^||VariableName) While (^||VariableName '= "") { Set ^||VariableNameList = ^||VariableNameList_$ListBuild(^||VariableName) Set ^||VariableName = $Order(@^||VariableName) } Quit ^||VariableNameList } This might do some things you don't expect depending on variable scope, though - possibly relevant depending on the use case you have in mind. Class Demo.Variables { ClassMethod OuterMethod() { Set x = 5 Do ..InnerMethod() } ClassMethod InnerMethod() [ PublicList = y ] { Set y = 10 Write $ListToString(..GetVariables()) } ClassMethod NoPublicListMethod() { Set y = 10 Write $ListToString(..GetVariables()) } ClassMethod GetVariables() As %List { Set ^||VariableNameList = "" Set ^||VariableName = "" Set ^||VariableName = $Order(@^||VariableName) While (^||VariableName '= "") { Set ^||VariableNameList = ^||VariableNameList_$ListBuild(^||VariableName) Set ^||VariableName = $Order(@^||VariableName) } Quit ^||VariableNameList } } Results: SAMPLES>kill set z = 0 d ##class(Demo.Variables).OuterMethod() y,z SAMPLES>kill set z = 0 d ##class(Demo.Variables).NoPublicListMethod() z
go to post Timothy Leavitt · Jun 9, 2016 If you specified credentials during installation and don't remember them, you can use this process to get to the terminal prompt: http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=... After starting in emergency access mode, you can run the command: Do ^SECURITY And navigate through the prompts to see what users there are and change the password of one so you can log in.
go to post Timothy Leavitt · Jun 8, 2016 That's odd - something may have gone wrong with your build. (This is an internal issue.)You can remove/change the "Source Control" class for the namespace in Management Portal:Go to System Administration > Configuration > Additional Settings > Source Control, select the proper namespace, select "None," and click "Save."
go to post Timothy Leavitt · Jun 7, 2016 The class you listed fails for me too, but it's because there's no package name, not because of the bracket mismatch. In Atelier, the class name gets an error marker: If I change it to: class somepackage.myclass { //if someVar { } Then the file will happily sync and compile. If adding the package doesn't fix things, it would be helpful to know what Atelier and Caché versions you're using.
go to post Timothy Leavitt · Jun 2, 2016 Export with File > Export > General > Preferences; check "Keys Preferences" (which only appears if you've customized any preferences)Import with File > Import > General > Preferences; select file then check "Keys Preferences"See: http://stackoverflow.com/questions/481073/eclipse-keybindings-settingsIt seems that the CSV export from Window > Preferences, General > Keys, Export CSV ... doesn't have a corresponding import feature.
go to post Timothy Leavitt · Jun 1, 2016 Ah - yes, a number of things log to ^%ISCLOG. It's very important to set ^%ISCLOG = 0 at the end to keep it from continuing to record. The command I mentioned previously is an easy way to make sure that you're only logging for a brief period of time - paste the command into Terminal and hit enter to start logging, then load the page, then hit enter in Terminal to stop logging. Still, there could be lots of other stuff in there even from having it enabled briefly depending on how busy the server is.It might make sense for you to contact InterSystems' outstanding Support department - someone could work through this with you directly and help you find a solution more quickly.
go to post Timothy Leavitt · May 31, 2016 Here's a sample, using %ToDynamicObject (2016.2+): Class DC.CustomJSONSample extends %RegisteredObject { Property myProperty As %String [ InitialExpression = "hello" ]; Property other As %String [ InitialExpression = "world" ]; /// Rename myProperty to custom_property_name Method %ToDynamicObject(target As %Object = "", ignoreUnknown = 0) [ ServerOnly = 1 ] { Do ##super(.target,.ignoreUnknown) Do target.$set("custom_property_name",target.myProperty,target.$getTypeOf("myProperty")) Do target.$remove("myProperty") } ClassMethod Run() { Set tObj = ..%New() Write tObj.$toJSON() } } Output: SAMPLES>d ##class(DC.CustomJSONSample).Run() {"other":"world","custom_property_name":"hello"} For other discussions with solutions/examples involving %ToDynamicObject, see:https://community.intersystems.com/post/json-cache-and-datetimehttps://community.intersystems.com/post/create-dynamic-object-object-id
go to post Timothy Leavitt · May 24, 2016 Also see the class documentation for Security.Applications:[quote]Bit 2 = AutheK5APIBit 5 - AutheCacheBit 6 = AutheUnauthenticatedBit 11 = AutheLDAPBit 12 = AutheLDAPCacheBit 13 = AutheDelegatedBit 14 = LoginTokenBit 20 = TwoFactorSMSBit 21 = TwoFactorPW[/quote]
go to post Timothy Leavitt · May 23, 2016 The problem is that REST uses IO redirection itself, and OutputToStr changes the mnemonic routine but doesn't change it back at the end. For a great example of the general safe approach to cleaning up after IO redirection (restoring to the previous state of everything), see %WriteJSONStreamFromObject in %ZEN.Auxiliary.jsonProvider. Here's a simple approach that works for me, in this case: set tOldIORedirected = ##class(%Device).ReDirectIO() set tOldMnemonic = ##class(%Device).GetMnemonicRoutine() set tOldIO = $io try { set str="" //Redirect IO to the current routine - makes use of the labels defined below use $io::("^"_$ZNAME) //Enable redirection do ##class(%Device).ReDirectIO(1) if $isobject(pObj) { do $Method(pObj,pMethod,pArgs...) } elseif $$$comClassDefined(pObj) { do $ClassMethod(pObj,pMethod,pArgs...) } } catch ex { set str = "" } //Return to original redirection/mnemonic routine settings if (tOldMnemonic '= "") { use tOldIO::("^"_tOldMnemonic) } else { use tOldIO } do ##class(%Device).ReDirectIO(tOldIORedirected) quit str It would be cool if something like this could work instead: new $io try { set str="" //Redirect IO to the current routine - makes use of the labels defined below use $io::("^"_$ZNAME) //Enable redirection do ##class(%Device).ReDirectIO(1) if $isobject(pObj) { do $Method(pObj,pMethod,pArgs...) } elseif $$$comClassDefined(pObj) { do $ClassMethod(pObj,pMethod,pArgs...) } } catch ex { set str = "" } quit str But $io can't be new'd.
go to post Timothy Leavitt · May 16, 2016 You could map the package containing the class related to that table using a package mapping, and the globals containing the table's data using global mappings.You can see which globals the class uses in its storage definition - since the entire package is mapped, it might make sense to add a global mapping with the package name and a wildcard (*).After taking those steps, you can insert to the table the way you usually would, without any special syntax or using zn/set $namespace.