go to post Eduard Lebedyuk · Jan 16, 2021 Great answer, but I'd like to add that there are two distinct cases for working with XDatas: Where XData itself is an object of work (for example generating a part of WSDL spec and saving it in a class XData). Where XData is just a container for miscellaneous data (for example a template with placeholders). The code above works for the first case, but for the second case it might be preferable to create an independent copy of an XData stream so that no locking happens - this prevents XData object access/modification errors, especially in Dev environments. Furthermore objectless way of getting XData contents would be faster. I usually use this method to get streams if my XData work falls into the second category: ClassMethod getClassXData(className, xdataName) As %Stream.Object { set stream = ##class(%Stream.TmpCharacter).%New() for i=1:1:$$$comMemberKeyGet(className,$$$cCLASSxdata,xdataName,$$$cXDATAdata) { do stream.WriteLine($$$comMemberArrayGet(className,$$$cCLASSxdata,xdataName,$$$cXDATAdata,i)) } quit stream } This code can be further improved for most use cases by replacing a stream with a string.
go to post Eduard Lebedyuk · Jan 12, 2021 To call @Marc Mundt's code from the terminal you need to execute this: do ##class(Sample.Util).SettingsByNameFunc("Port").%Display()
go to post Eduard Lebedyuk · Jan 5, 2021 I used %iFind.Highlight as shown in the docs for highlight function. Even went to sources and checked if it was a generator maybe - it was not, so I stopped my search for more index-specific option. Switching to [package name].[table name]_[index name]Highlight() now. Also how can[package name].[table name]_[index name]Find() and ...Rank() be used?
go to post Eduard Lebedyuk · Jan 5, 2021 Thank you! That's exactly what I need. I knew about iKnow relational mappings, but not iFind ones. If you want to count any kind of match, your highlight trick is probably the nicest way to get at it. The problem with this approach is: It actually reindexes the source again which takes time It does not seem to be aware of the index so index parameters would be missed as only INDEXOPTION can be passed.
go to post Eduard Lebedyuk · Jan 5, 2021 No, the text is plaintext and does not contain any HTML. highlight function by default highlights with <b>text</b>.
go to post Eduard Lebedyuk · Jan 5, 2021 Went with: SELECT SUM($LENGTH(%iFind.Highlight(Text, :name), '<b>')-1) FROM Post WHERE %ID %FIND search_index("TextIndex",:name) Assumes plaintext.
go to post Eduard Lebedyuk · Jan 5, 2021 Great. This should also work: cursor.execute('SELECT * FROM exp.MD5NoMatch(?,?,?)',('exchange', 'cplx','channel'))
go to post Eduard Lebedyuk · Jan 4, 2021 JDBC (docs): import pandas as pd import jaydebeapi cnxn=jaydebeapi.connect("com.intersystems.jdbc.IRISDriver","jdbc:IRIS://localhost:51773/Python", ["dev", "123"], "/InterSystems/IRIS/dev/java/lib/JDK18/intersystems-jdbc-3.0.0.jar") Data=pd.read_sql('SELECT 1',cnxn) cnxn.close() ODBC (docs): import pandas as pd import pyodbc cnxn=pyodbc.connect(('DSN=ENSEMBLE(PYTHON);UID=dev;PWD=123'),autocommit=True) Data=pd.read_sql('SELECT 1',cnxn) cnxn.close() I would much prefer to simply execute the debugged and more secure class queries that already exist and and have been precompiled. Sure, this works too: SELECT * FROM Class.Query
go to post Eduard Lebedyuk · Jan 4, 2021 It would be a response in whatever tool you sent your request.