go to post Vitaliy Serdtsev · Apr 12, 2022 Addition to the above: Indexing an Embedded Object (%SerialObject) Propertydoc
go to post Vitaliy Serdtsev · Apr 12, 2022 Choose according to your taste: #include %systemInclude s s=$c(34,34)_"te""""st"_$c(34,34) w s,!, ##class(%Global).UndoubleInnerQuotes(s),!, $$$StripQuotes(s),!, $tr(s,$c(34),"")Output: USER>d ^test ""te""st"" "te"st" "te"st" test
go to post Vitaliy Serdtsev · Apr 11, 2022 Maybe you will help the trick taken from Storing dynamic object properties larger than 3641144 symbols
go to post Vitaliy Serdtsev · Apr 11, 2022 I'm not sure if it's %Text at all. Made a small example: Class dc.test Extends %Persistent { Index mySimilarityIndex On SettingsJSON(KEYS) [ Data = SettingsJSON(ELEMENTS) ]; Property SettingsJSON As %Text(LANGUAGECLASS = "%Text.English", MAXLEN = 3600000, SIMILARITYINDEX = "mySimilarityIndex"); ClassMethod Test() { d ..%KillExtent() s json=$tr($j("",3600000)," ","0") &sql(insert into del.t(SettingsJSON) values(:json)) w $l(json),":",SQLCODE } }Output: 3600000:0
go to post Vitaliy Serdtsev · Apr 11, 2022 For %Stream.GlobalCharacter cannot use an index, but it can be used for %Text. UPD: Queries Invoking Free-text Search
go to post Vitaliy Serdtsev · Apr 11, 2022 Here's what I found: IndexClass (%Dictionary.ClassDefinition) IndexClass (%Dictionary.CompiledClass) That is, you can write something like this: Class dc.test Extends %Persistent [ IndexClass = dc.anothertest ] { }The same applies to MemberSuper. Unfortunately, I haven't found any examples of how to use it or if it works at all.
go to post Vitaliy Serdtsev · Apr 11, 2022 Class dc.test Extends %Persistent { Property F As %Integer; ClassMethod Test() { d ..%KillExtent() &sql(insert into dc.test(F) values(22)) &sql(insert into dc.test(F) values(11)) s label = "00007I0Q" &sql(select ID into :cnt from dc.test where ID = :label) w SQLCODE,":",cnt } }Output for Caché 2018.1: 100:00007I0Q Output for IRIS 2021.2: 100: PS: it is a pity that my answer was ignored.
go to post Vitaliy Serdtsev · Apr 11, 2022 Any event that occurs outside of the modal group (such as a mouse click) automatically hides the modal groupproof. Use Popup windows with modal=yes or Dialogs. PS: if you really need to use "Model Groups", then you need to do two things for this: override the method onCanEndModalHandler override the method hideGroup(). This is necessary to prohibit the close button in the upper right corner Here is a small variant: Class dс.test Extends %ZEN.Component.page { XData Contents [ XMLNamespace = "http://www.intersystems.com/zen" ] { <page xmlns="http://www.intersystems.com/zen"> <button caption="Show modal group" onclick="zenPage.show();"/> <modalGroup id="mgStatic" groupTitle="Popup"> <text id="mgText" label="Value:" /> <button caption="OK" onclick="zenPage.mgBtnClick();"/> </modalGroup> </page> } ClientMethod show() [ Language = javascript ] { zenPage.__canClose = false; var mg = zen('mgStatic'); mg.onCanEndModalHandler = this.onCanEndModalHandler(); mg.hideGroup=this.hideGroup; mg.show(); } ClientMethod mgBtnClick() [ Language = javascript ] { zenPage.__canClose=true; zen('mgStatic').onCanEndModalHandler=null; zenAlert('User entered: ' + zen('mgText').getValue()); // hide the modal group zenPage.endModal(); } ClientMethod onCanEndModalHandler() [ Language = javascript ] { return true; } /// Hide the group. ClientMethod hideGroup() [ Language = javascript ] { if (!zenPage.__canClose) return; if (this.groupType == 'dialog') this._canClose = true; var div = this.getFloatingDiv(); if (div) { div.style.opacity = 0; } if ((!zenIsHTML5) || (!window.TransitionEnd)) { if (!this._closing) { zenPage.endModal(); this._closing = true; } } } }
go to post Vitaliy Serdtsev · Apr 11, 2022 Hi Ben. For some reason, only IRIS 2021.1CE is available for Windows, although IRIS 2021.2CE is available for many other operating systems, such as MacOSX. Is it possible for Windows to update the version to 2021.2 too?
go to post Vitaliy Serdtsev · Apr 11, 2022 You should always check the SQLCODE after the embedded query.If you do this, you will see that the SQLCODE returns the value 100 for your case. In this case, you should ignore host variables. Host Variables
go to post Vitaliy Serdtsev · Apr 8, 2022 How to highlight ObjectScript in a Post How to highlight Caché ObjectScript, work with htm, add image in the post and other questions Posting here your real code AS IS is a bad idea. Most likely there is a method(s) in your code where the last line of your tablepane is highlighted.
go to post Vitaliy Serdtsev · Apr 7, 2022 One of the options: s rs=##class(%ScrollableResultSetdoc).%New() d rs.Prepare(sql) d rs.Execute() w rs.Count()
go to post Vitaliy Serdtsev · Apr 7, 2022 Is it OK to use this partially rebuilt index if I don't care about data that isn't indexed? Did you do this before? I didn't build indexes manually, except for tests. If the index is not built for all data, then the query will see only the data for which the index exists. Try simple example: Class dc.test Extends %Persistent { Index iF On F; Property F As %Integer; ClassMethod Fill(N = 10) { k ^dc.testD,^dc.testI s ^dc.testD=4 s ^dc.testD(1)=$lb("",22) s ^dc.testD(2)=$lb("",11) s ^dc.testD(3)=$lb("",44) s ^dc.testD(4)=$lb("",33) d $system.SQL.TuneTable($classname(),$$$YES) d $system.OBJ.Compile($classname(),"cu-d") k ^dc.testI d ##class(%SQL.Statement).%ExecDirect(,"select * from dc.test").%Display() s ^dc.testI("iF",1,22)="" w !! d ##class(%SQL.Statement).%ExecDirect(,"select * from dc.test").%Display() s ^dc.testI("iF",4,33)="" w !! d ##class(%SQL.Statement).%ExecDirect(,"select * from dc.test").%Display() } }
go to post Vitaliy Serdtsev · Apr 7, 2022 The %BuildIndices() supports partial rebuilding - see parameters pStartID, pEndID In addition, you can activate/deactivate the index: Building Indices on a READ and WRITE Active System
go to post Vitaliy Serdtsev · Apr 7, 2022 If we open the source code of the class for the Status field, we will see the following: Class Ens.DataType.MessageStatus Extends %Integer { Parameter DISPLAYLIST = ",Created,Queued,Delivered,Discarded,Suspended,Deferred,Aborted,Error,Completed"; Parameter VALUELIST = ",1,2,3,4,5,6,7,8,9"; }Therefore , the following conclusions can be drawn: For Embedded SQL the RuntimeMode is Logical For SQL Explorer (Portal) the RuntimeMode is Display Hence the leapfrog in the results.
go to post Vitaliy Serdtsev · Apr 7, 2022 Try this: ClassMethod OnStartRequest() As %Status { #dim %response As %CSP.Response ;s %response.ContentType="text/html",%response.Expires=-1 s %response.Status=##class(%CSP.REST).#HTTP403FORBIDDEN q $$$OK }Or this: /// Event handler for <b>PreHTTP</b> event: this is invoked before /// the HTTP headers for a CSP page have been sent. All changes to the /// <class>%CSP.Response</class> class, such as adding cookies, HTTP headers, /// setting the content type etc. must be made from within the OnPreHTTP() method. /// Also changes to the state of the CSP application such as changing /// %session.EndSession or %session.AppTimeout must be made within the OnPreHTTP() method. /// It is prefered that changes to %session.Preserve are also made in the OnPreHTTP() method /// as this is more efficient, although it is supported in any section of the page. /// Return <b>0</b> to prevent <method>OnPage</method> from being called. ClassMethod OnPreHTTP() As %Boolean [ ServerOnly = 1 ] { s %response.Status="403 Forbidden" q 0 }
go to post Vitaliy Serdtsev · Apr 7, 2022 We need to look at your full code, since there is nothing suspicious in the specified piece of code. I made a small example and there is no highlighting of the last line: Source code Class dс.test Extends %ZEN.Component.page { XData Contents [ XMLNamespace = "http://www.intersystems.com/zen" ] { <page xmlns="http://www.intersystems.com/zen"> <tablePane width="1200px" id="ItemsTable" OnCreateResultSet="GetLog" maxRows="20000" pageSize="20" showRowNumbers="false" showRowSelector="false" showZebra="false" valueColumn="ID" nowrap="false" showValueInTooltip="true" showFilters="true" autoExecute="true" initialExecute="false" useSnapshot="true" onselectrow=""> <parameter /> <parameter /> <parameter /> <parameter /> <parameter /> <parameter /> <parameter /> <column colName="Sit" header="Sit name" width="50%" style="text-align:left;" filterType="text" filterOp="[" /> <column colName="Label" header="Label" width="10%" filterType="text" filterOp="["/> <column colName="userno" header="Packed By" width="10%" filterType="text" filterOp="["/> <column colName="LogedDate" header="Packed Date" width="10%" /> <column colName="LogedTime" header="Packed Time" width="10%" /> <column colName="TimeSpent" header="Spent Time" width="10%" style="text-align:left;"/> </tablePane> <tableNavigatorBar tablePaneId="ItemsTable"/> </page> } Method GetLog( ByRef pSC, ByRef tParams) { s sql = 5 s sql(1)="SELECT 0 ID,'Sit' Sit,'Label' Label,'userno' userno,current_date LogedDate,current_date LogedTime,null TimeSpent" s sql(2)="union" s sql(3)="SELECT 1,'Sit','Label','userno',current_date,current_date,null" s sql(4)="union" s sql(5)="SELECT 2,'Sit','Label','userno',current_date,current_date,null" s st=##class(%SQL.Statement).%New() s st.%SelectMode=2 q ##class(%SQL.Statement).%ExecDirect(st,.sql) } }
go to post Vitaliy Serdtsev · Apr 7, 2022 I confirm (used the following code): #include %systemInclude n try{ s sql="select * from (select 0 field union select 1) where 0=1" #dim rs As %SQL.StatementResult=##class(%SQL.Statement).%ExecDirect(,sql) w rs.%SQLCODE s st = ##class(%SQL.Statement).%New() $$$ThrowOnError(st.%Prepare(sql)) s rs = st.%Execute() w !,"---",!,rs.%SQLCODE &sql(select * from (select 0 field union select 1) where 0=1) w !,"---",!,SQLCODE }catch(ex){ w "Error ", ex.DisplayString(),! } Output: 0 --- 0 --- 100 Quote from the documentation: When retrieving results, first check for successful execution by examining %SQLCODE. For many statement types, success/failure is all that is needed. The %SQLCODE property contains the SQL error code value. Successful completion values are 0 (successful completion) and 100 (the operation has either found no data or reached the end of the data).proof