Alexander Koblov · Jul 2, 2019 go to post

Thank you Alexey. Yes, you are correct, second statement is correct. I've asked to modify first statement.

Alexander Koblov · Jul 30, 2019 go to post

Seems to work. Please provide small standalone example, so that we can reproduce

C:\InterSystems\ENSEMBLE2017x2x2\bin>set AA=22

C:\InterSystems\ENSEMBLE2017x2x2\bin>echo %AA%
22

C:\InterSystems\ENSEMBLE2017x2x2\bin>cache -s ..\mgr

Узел: ru-akoblovW10VM, Экземпляр: ENSEMBLE2017X2X2

USER>w $system.Util.GetEnviron("AA")
22
Alexander Koblov · Aug 5, 2019 go to post

Daniel,

you don't have DeepSee Model and DeepSee Analyze enabled in "Extended feature codes". That's why these menu options are grayed out.

Check with InterSystems Sales to get a license with these bits enabled.

Alexander Koblov · Aug 14, 2019 go to post

Hi Alexey.

I'm not aware of such event handler.

However, I wonder why do you need it at all? If you provide use case, perhaps we can advice some other way to achieve it.

Alexander Koblov · Aug 22, 2019 go to post

Good idea in such cases -- enable Audit and audit events LoginFailure and Protect. Reproduce the problem and then check Audit log.

Alexander Koblov · Aug 27, 2019 go to post

I understand that get data method only needs to return the Y-Axis values

Yes!

Do you think it is good to try and store values for x and y-Axes in the same data array?

No, keeping values in getChartData and labels for X axis in getAxisTime is fine.

Alexander Koblov · Aug 30, 2019 go to post

You can use $system.OBJ.Export to export LUT document to file:

ENSDEMO>w $system.OBJ.Export("AlertTable.LUT","c:\temp\qq.lut")
 
Exporting to XML started on 08/30/2019 12:03:14
Exporting type : AlertTable.LUT
Export finished successfully.
1
ENSDEMO>w $system.OBJ.Load("c:\temp\qq.lut")
 
Load started on 08/30/2019 12:03:26
Loading file c:\temp\qq.lut as xml
Imported document: AlertTable.LUT
Load finished successfully.
1
Alexander Koblov · Aug 30, 2019 go to post

Name the file login.csp

And inside it check for Error:ErrorCode request parameter:

<html><head><title>Login</title></head>
<body>
My login page:</br>
<form method='post'>
Name: <input name="CacheUserName"/><br/>
Password: <input type='password' name="CachePassword"/><br/>
<input type='submit'/>
</form>

<server>
Set tMsg = $Get(%request.Data("Error:ErrorCode",1))
    If ((tMsg'="")&&($SYSTEM.Status.GetErrorCodes(tMsg)'[$$$ERRORCODE($$$RequireAuthentication))) {
        &html<<center>>
        write "Auth failed!"
        &html<</center>>
    }
</server>
</body>
</html>
Alexander Koblov · Sep 2, 2019 go to post

If you have index.csp and it is specified as login page and you are seeing 404 error, try following:

a) Enable Audit b) Enable Protect event in Audit c) Reproduce the problem. e) Check Audit records if any Protect errors were logged

Alexander Koblov · Sep 2, 2019 go to post

I like usage of parameter, as it is computed once -- at compile time. And after you only fetch value in cycle.

You can also use $listfromstring via the same technique.

Alexander Koblov · Sep 6, 2019 go to post

CASE statement expects expression after THEN. DESC or ASC are not expressions. That's why you are getting syntax error.

So you need to supply some expression, ordering by which would mean reverse ordering by FirstName.

I don't know how to do this.

I would do sorting on the client or use dynamic SQL to create the query. As below for example.

Important! Nowhere I concatenate parameters of the stored procedure with the query to avoid SQL injections. Only SortingField is concatenated after checking that it has approved value.

ClassMethod Search(
    Name As %String = "",
    SSN As %String = "",
    Title As %String = "",
    SortingField As %String = "",
    StartIndex As %String = "") As %Integer [ SqlName = ExternalUsersSearch, SqlProc ]
{
 set query = "select Name, Title, SSN from Sample.Employee WHERE 1=1 "
 kill args
 
 if Name'="" {
     set args($I(args)) = Name
     set query = query _ "AND Name like ? "
 }
 
 if SSN'="" {
     set args($I(args)) = SSN
     set query = query _ "AND SSN like ? "
 }
 
 if Title'="" {
     set args($I(args)) = Title
     set query = query _ "AND Title like ? "
 }
 
 set AllowedFieldsToOrderBy = $LB("Name", "SSN", "Title")
 if $ListFind(AllowedFieldsToOrderBy, SortingField) {
    set query = query _ " ORDER BY " _ SortingField
    
    if StartIndex = 1 {
        set query = query _ " DESC"
    } else {
        set query = query _ " ASC"
    }
 }

 set rs = ##class(%SQL.Statement).%ExecDirect(,query,args...)

 #dim %sqlcontext As %SQLProcContext
 if rs.%SQLCODE >=0 {
     do %sqlcontext.AddResultSet(rs)
 } else { // pass errors to the caller
     set %sqlcontext.%SQLCODE = rs.%SQLCODE
     set %sqlcontext.%Message = rs.%Message
 }
 quit 1
}
Alexander Koblov · Sep 17, 2019 go to post

To add on what Dmitry said.

We need to see the query, its plan and corresponding classes with selectivity information.

For example, do you really want to run query without join condition?

select o.col1, o.col2, op.partnum, op.amount
from orders o join orderpositions op
where o.orderDate > $H-1000
Alexander Koblov · Oct 7, 2019 go to post

Relative cost is only used to compare different plans for the same query. Relative cost is not useful for comparing two different queries.

Can you post screenshot of both queries with corresponding plans?

Alexander Koblov · Dec 20, 2019 go to post

I also see this error for some tables. I don't know what's causing this.

I've googled it and looks like some error with ODBC Connections from Power BI.

Alexander Koblov · Dec 27, 2019 go to post

David,

relative cost is only useful when you compare different plans for the same query. By itself "relative cost" means nothing.

To look into query performance we need to see a) Query itself b) Execution plan c) Sources of all classes / tables from the query, so that we see how fields are defined, indexes that are available and selectivity of fields.

Alexander Koblov · Jan 9, 2020 go to post

Check if you have Windows-keys enabled in Terminal settings.

If yes -- this can handle Ctrl-C as "Copy to clipboard"

Alexander Koblov · Jan 13, 2020 go to post

Not necessarily

 set CNT=10e7
 
 write "for test",!
 set z1 = $zh
 for i=1:1:CNT {
 }
 set z2=$zh-z1
 write "time: ",z2,!
 
 
 write "while test",!
 set z1 = $zh
 set i=1
 while i<=CNT {
	 set i = i+1
 }
 set z2=$zh-z1
 write "time: ",z2,!

Running this program:

USER>do ^test
for test
time: 2.017099
while test
time: 1.542252
Alexander Koblov · Jan 16, 2020 go to post

Yes, first screenshot illustrates what I said.

CSPSystem tries access User.Login in USER database, but fails.

Give CSPSystem role that has resource protecting user database.

Close all connections from Web Gateway to IRIS.

Try again. It should work

Alexander Koblov · Jan 16, 2020 go to post

Neerav,

relative cost is only useful when you compare different plans for the same query. By itself "relative cost" means nothing.

Alexander Koblov · Mar 17, 2016 go to post

Why do you need this?

For example, for debugging purposes you might use second argument of Get method:

do request.Get(,1)

In that case "instead of connecting to a remote machine httprequest will just output what it would have send to the web server to the current device".

Alexander Koblov · Mar 29, 2016 go to post

By default %ToJSON method prints empty properties.

If you pass pFormat without "e" flags (that is passed by default), then empty properties are skipped:

USER>set p = ##class(%ZEN.proxyObject).%New()
 
USER>set p.a = 1
 
USER>set p.b = 2
 
USER>do p.%ToJSON()
{
        "a":1,
        "b":2
}
USER>set p.b = ""
 
USER>do p.%ToJSON()
{
        "a":1,
        "b":""
}
USER>do p.%ToJSON(,"alotw")
{
        "a":1
}

I encourage you to use Caché 2016.1 with native JSON support. Don't start with %ZEN.proxyObject. See great article by Stefan Wittman about JSON support in 2016.1: https://community.intersystems.com/post/introducing-new-json-capabilities-cach%C3%A9-20161

Alexander Koblov · Apr 21, 2016 go to post

SQL Adapter does some metadata caching.

See, for example, doc for method EnsLib.SQL.Common:ExecuteProcedure http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=ENSLIB&CLASSNAME=EnsLib.SQL.Common#METHOD_ExecuteProcedure

"Appending a '#' to the pIO argument (or passing only '#') prevents the adapter from using cached DescribeColumns() results for the procedure call output, forcing a fresh call to ODBC DescribeColumns() every time the stored procedure is invoked. This can be necessary if the procedure is capable of returning different sequences of result types from consecutive invocations"

I'm not sure if this is what happened in this case, though.