See MultiValue Basic | Caché Alternative Exists for SOUNDEX()

Workaround:

Class dc.test Abstract ]
{

ClassMethod Test()
{
  
  ..SOUNDEX("M"),!

  ;or

  &sql(select SOUNDEX('McD'into :r)
  r,!
}

ClassMethod SOUNDEX(sAs %String Language = mvbasic, SqlName SOUNDEXSqlProc ]
{
 RETURN SOUNDEX(s)
}

}

Result:

USER>##class(dc.test).Test()
M000
M230

Excellent work.yes

You have come up with an additional optimization different from mine. Your code can be improved to 66.

 
size = 68
 
size = 67
 
size = 66

Ok.

 
size = 190
 
size = 189
 
size = 74

I'm not publishing the option with size = 73 yet, to wait, maybe someone will guess how to do it or offer an ever shorter option (by analogy with Code Golf - Encoder).

UPD: I managed to reduce size to 72.

 
Example

Output (tested on IRIS 2021.2CE):

USER>##class(dc.golf.Anagram).Detector("apple""pale")
 
<UNDEFINED>zDetector+2^dc.golf.Anagram.1 *a

If I change Undefined, then there is no error, but the result is incorrect:

USER>d $system.Process.Undefined(2)
 
USER>##class(dc.golf.Anagram).Detector("apple""pale")
"apple":5 - "pale":4
0

The code works correctly if change the signature of the method (ProcedureBlock/PublicList/new), but this is a violation of the conditions of the task.

See %ZEN.Auxiliary.jsonSQLProvider:%WriteJSONStreamFromSQL()

 
Simple example

The contents of the file test.json (UTF8):

{
"children":[
{"ID":1,"Date":"04.05.2022","bool":0,"int":30,"str":"Hello Caché"}
,{"ID":2,"Date":"31.12.1840","bool":1,"int":303,"str":"ăîşţâ"}
,{"ID":3,"Date":"","bool":"","int":"","str":""}
]
}

I already tried option 1 with Timeformat=1 for the avg and didn't work.

Have you changed the TimeFormat at the process or system level?
If at the process level, then most likely you have changed this value in one process, and are executing the query in another. Therefore, there is no effect.
If at the system level, then the query should work.

To avoid uncertainty, change the definition of the field

Property PackingTimeSpent As %Time;

and execute in SMP for Display Mode

select PackingTimeSpent from MSDS_Serenity.KitlabelAssoc

The hh:mm:ss format string should be displayed.

so eg. select %external(CAST(+avg(166.38) as TIME)) didn't work for me

Two remarks:

  • this will work as intended only if you have changed the TimeFormat=1 at the system level
  • avg(166.38) - it's pointless to write like that.

you mentioned the example above and I'm not sure to which one are youi refering to with so many replies, so can you point me to which one exactly

See Time-to-String Conversionlink

Try this (does not depend on the TimeFormat value of the current locale):

select TO_CHAR(avg(PackingTimeSpent),'HH24:MI:SS'average from MSDS_Serenity.KitlabelAssoc where label='00007IT4'

PS: By the way, I noticed in your screenshots the differences in queries:
somewhere you write

where label='00007IT4'

somewhere you write

where ID='00007IT4'

Is this how it should be?
To avoid unnecessary questions, please do not change everytime the names of the fields in the queries. This is misleading.