- Log in to post comments
- Log in to post comments
Here you will find a lot of useful things in particular $QLENGTH: Using Globals
- Log in to post comments
BUILD INDEX (via SQL) %BuildIndicesXXX()
- Log in to post comments
- Log in to post comments
- Log in to post comments
See documentation: $ZF(-100) requires the %System_Callout:U privilege. And check "Error Handling".
- Log in to post comments
See documentation: Frequently Asked Questions About CSP: How do I debug a CSP page?
- Log in to post comments
Why not use numeric codes?
$ascii("á") = 225
set s1=$zconvert("Flávio","I","HTML"),
s2=$zconvert("Flávio","I","HTML")
write s1,$select(s1=s2:" = ",1:" <> "),s2
- Log in to post comments
Don't pay attention, someone very needs an Apple iPad.
I found a very interesting article about a very ancient language, but it's not Mumps
:
Banks scramble to fix old systems as IT 'cowboys' ride into sunset
- Log in to post comments
How do you count "Count"? Why is "Northwest" 1 instead of 2 for 2021?
For now so:
select v.Branch, nvl(sum(c %FOREACH(v.Branch)),0) "Count" from
(
select 'Northwest' Branch,$listbuild('Northern','Western') Branches union
select 'Oriental',$listbuild('Eastern') union
select 'Southern',$listbuild('Southern')
) v
left join
(select replace(%exact(Branch),' branch','') Branch,count(* %FOREACH(Branch)) c from yourtable where year("Date")=2021 group by Branch) m
on m.Branch %inlist v.Branches
group by v.Branch- Log in to post comments
Can you provide a small sample table with the data and the result you want to get?
- Log in to post comments
You are implicitly using %Library.SqlQuery:Func() method, in which, as @Robert Cemper rightly pointed out, $get() is used.
You can do it differently:
Query GetInfo(pObject AS Kurro.MyClass) As %SQLQuery(CONTAINID = 1, ROWSPEC = "IdList:%String,IdProcess:%String,Duration:%String") [ SqlProc ]
{
SELECT IdList, IdProcess, Duration
FROM Kurro.MyClass
WHERE KeyProcess = :pObject.KeyProcess
AND CodeSpecialist = :pObject.CodeSpecialist
AND CodeProvider = :pObject.CodeProvider
AND CodeCenter = :pObject.CodeCenter
AND "Date" = :pObject.Date
}
set obj=##class(Kurro.MyClass).%New()
set obj.KeyProcess="1033004-1#"
set obj.CodeSpecialist = "surgery"
set obj.CodeProvider = "PR002"
set obj.CodeCenter = "CENTER-01"
set obj.Date = $ZDATETIME($ZDATETIMEH("2021-04-30 15:45:00",3,1),3,1)
set st=##class(%SQL.Statement).%New()
set sc=st.%PrepareClassQuery("Kurro.MyClass","GetInfo")
if $$$ISERR(sc) {write "%PrepareClassQuery failed:" do $System.Status.DisplayError(sc) quit}
set result=st.%Execute(obj)
do result.%Display()
- Log in to post comments
I don't quite understand what you want to get.
If in the forehead, then so:
Select v.valueId, m.name From (Select 1 valueId Union Select 2 Union Select 3 Union Select 4 Union Select 5) v left Join otherTable m on m.id = v.valueId
But you can achieve the same thing more easily through IN or %INLIST.
- Log in to post comments
You can easily do this by replacing two values in the registry.
Just checked on Caché & IRIS: SMP and Terminal (##class(%SYS.System).GetInstanceName()) displays the new instance name.
Upgrade/Deinstall work fine too.
If desired, you can also replace the service names (private Apache, etc.).
- Log in to post comments
Then add a role with the appropriate permissions to your web application: Editing an Application: The Application Roles Tab Don't forget to restart the web app after that for the changes to take effect
- Log in to post comments
You don't need to grant rights to the users whose properties you want to get.
Access rights (resource %DB_CACHESYS:R) you need to give the user from which your GetUserInfo method will run.
- Log in to post comments
Your user must have access privileges to the %SYS namespace: SET $NAMESPACE
- Log in to post comments
There's clearly something wrong with the settings here. What web server do you use, did you configure something in the CSP Gateway? Is the error reproduced when accessing (edit&compile) pages from USER/SAMPLES (of course, if you have them installed)?
- Log in to post comments
If you use Studio to edit/compile *.csp files, check the following parameters:
- Enable service status check (Recommended) (yes)
- Studio is active application (2–60 sec) (5)
- Studio is background application (30–600 sec) (60)
- Automatically reload document when it is modified on the server and it has not been edited in Studio (yes)
I tried to simply edit the file in Studio (csp/samples/redirect.csp) and with an external editor FAR Manager ([CACHEROOT]\CSP\samples\redirect.csp) For simplicity, I changed the comment in the header. I tested everything both locally and remotely.
So, I change it in Studio - the changes are immediately visible in FAR, I change it in FAR - the changes are immediately visible in Studio. Or in another way: I change it locally - the changes are immediately visible on the remote machine, I change it on the remote machine - the changes are immediately visible locally.
In other words, there is no and cannot be any desynchronization, since the work is always done with the same file on the server, see Saving a CSP File.
- Log in to post comments
Apparently, you have autocompile enabled for the CSP application: Automatic and Manual Page Compilation And also check the parameter Recurse
- Log in to post comments
Important:
Jobbed Process Permissions are Platform-dependentRunning Programs or System Commands with $ZF(-100)
So that we speak the same language, I made a simple example using Using the Work Queue Manager
Class dc.test [ Abstract ]
{
ClassMethod MyJob(SDIR As %String)
{
s FILE=##class(%File).NormalizeFilename("DIRLIST.TXT",SDIR)
q:##class(%File).GetFileSize(FILE)>0
d ##class(%File).Delete(FILE)
s X=$ZF(-1,$$$FormatText("DIR %1 >> %2",$$$quote(##class(%File).NormalizeDirectory(SDIR)),$$$quote(FILE)))
}
/// d ##class(dc.test).test()
ClassMethod test()
{
s N=4
s queue=$system.WorkMgr.Initialize(,.sc,N)
f i=1:1:N d queue.Queue("##class(dc.test).MyJob","C:\Temp\test "_i)
d queue.WaitForComplete()
}
}I copied different files to the following directories:
C:\Temp\test 1 C:\Temp\test 2 C:\Temp\test 3 C:\Temp\test 4
After calling d ##class(dc.test).test() , everything worked out as expected: DIRLIST.TXT were created in the corresponding directories each with its own content.
- Log in to post comments
You can still avoid code duplication.
To do this, you need to make a function, and already use it in query.
For example:
/// Linked Funds via Person->Fund link
ClassMethod LinkedFundsByPerson(personId As %Integer) As %Boolean [ SqlName = CUSTOM_MyQuery, SqlProc ]
{
&sql(SELECT NULL FROM QUASAR_Core_Client.Client AS Client
INNER JOIN QUASAR_KYC_Fund.Fund AS Fund ON Client.Number=Fund.InternalReference
LEFT JOIN QUASAR_GDPR_Close_Fund.FundClosure As FundClosure ON Client.Number=FundClosure.ID
WHERE Client.ClientMarketIndicator='C'
AND Client.Number IN
(
SELECT Client
FROM QUASAR_KYC_Person.FundLink
WHERE Person->InternalReference=:personId
)
)
QUIT ''%ROWCOUNT
}
SELECT *
FROM TableA
WHERE CUSTOM_MyQuery(ID)>0
- Log in to post comments
You can't pass IDENTIFIER to class query, but only LITERALS. This is akin to error 5262:
Cannot project query with parameters '%1' as view
Here is a simple demo of this issue:
Class dc.test Extends %Persistent
{
Property p As %Integer;
Query LinkedFundsByPerson(p As %Integer) As %SQLQuery(ROWSPEC = "p:%Integer") [ SqlName = CUSTOM_MyQuery, SqlProc ]
{
SELECT p FROM dc.test
where ID IN
(
SELECT ID
FROM dc.test
WHERE p=:p
)
}
ClassMethod test()
{
&sql(SELECT * FROM dc.test WHERE EXISTS (SELECT * FROM dc.CUSTOM_MyQuery(ID)))
}
}- Log in to post comments
If something does not suit in the bundle Backup.General:ExternalFreeze()/ExternalThaw(), then can try the bundle SYS.Database:DismountDatabase()/MountDatabase(). Or at all SYS.Database:Copy().
- Log in to post comments
See CREATE FUNCTION
- Create your own counting function:
CREATE FUNCTION my.GetCalcTableExtentSize(IN SchemaName SYSNAME, IN TableName SYSNAME) RETURNS BIGINT('') PROCEDURE LANGUAGE OBJECTSCRIPT { quit ##class(%SQL.Manager.Catalog).GetCalcTableExtentSize(SchemaName, TableName) } - Now you can use it in queries:
select table_schema "Schema", table_name TableName,my.GetCalcTableExtentSize(table_schema,table_name) RowCount from information_schema.tables where table_type in ('BASE TABLE','VIEW')
- Log in to post comments
See %Regex.Matcher
Example:
s text = "This is a sample blob of text",
keywords="This,blob,text"
s matcher=##class(%Regex.Matcher).%New($tr(keywords,",","|")),
matcher.Text=text
w:matcher.Locate() "hit",!
d matcher.ResetPosition()
while matcher.Locate() {write "Found ",matcher.Group," at position ",matcher.Start,!}
USER>d ^test
hit
Found This at position 1
Found blob at position 18
Found text at position 26Or see $locate: Using Regular Expressions in Caché
Example:
USER>w $locate(text,$tr(keywords,",","|"),1,e,x) 1
- Log in to post comments
By the way, InterSystems employees have already given examples of undocumented code here, which can be found independently in %SYS:
- https://community.intersystems.com/post/there-way-get-internal-private-property
- https://community.intersystems.com/post/what-best-way-serialize-objectlistarrayetc-string#comment-84976
- Log in to post comments
If you look at a modern version of Caché or IRIS you'll find that ^%SYS.SECURITY is hidden.What does the source code of ^%SYS.SECURITY have to do with it? The fact that it is hidden does not play any role here.
Take a look at the code %CSP.Portal.Home:%OnPreHTTP()
- Log in to post comments