Eduard Lebedyuk · Apr 22, 2020 go to post

Offtopic but generic JDBC provider for SQLAlchemy has been discussed for years in Python community but nothing has been done.

Eduard Lebedyuk · Apr 16, 2020 go to post

Well, %Collection classes are the implementation of these constructs:

  • Property X As List Of Type
  • Relationships

You can call their methods but do not explicitly create objects of these classes.

Eduard Lebedyuk · Apr 15, 2020 go to post

There is actually. %GetSerial method builds a $lb from %ListOfDataTypes and %SetSerial does the reverse.

Both of these methods are private though. You can subclass %ListOfDataTypes and publish them.

Eduard Lebedyuk · Apr 15, 2020 go to post

I advice solving your problem by tightening security.

Your app user should have access only to the tables needed for the application to run.

If the user doesn't have any additional/admin roles, he won't see any other tables.

Eduard Lebedyuk · Apr 15, 2020 go to post

I think fairly straightforward approach works best

set l = ##class(%ListOfDataTypes).%New()
do l.Insert(1)
do l.Insert(2)
do l.Insert(4)
set lb = ""
for i=1:1:l.Count() { set lb = lb _ $lb(l.GetAt(i)) }
zw lb
>lb=$lb(1,2,4)
Eduard Lebedyuk · Apr 6, 2020 go to post

How do you import an HL7 Schema from ObjectScript?

You can call any method with Invoke.

I'm not aware of anything HL7 specific in %Installer, but maybe HealthShare has something.

Eduard Lebedyuk · Apr 1, 2020 go to post

I suppose I can have one Id column and several col1, col2 ..., colN columns, so losing the names.

Eduard Lebedyuk · Apr 1, 2020 go to post

Thank you for the info, Daniel!

Can I implement %GetProperty instead of specifying the list of properties explicitly?

I don't want to compile a new class for each new table-object.

Eduard Lebedyuk · Mar 31, 2020 go to post

Alternatively, %Dictionary package macros can be used:

ClassMethod Values(class = {$classname()}, property) As %Status  [ CodeMode = expression]
{
$$$defMemberArrayGet(class,$$$cCLASSproperty,property,$$$cPROPparameter,"VALUELIST")
}

Also, you can find object from list without explicitly iterating the whole thing:

set i = %class.Properties.FindObjectId(%class.Name _ "||" _ "Status")

instead of:

for i=%class.Properties.Count():-1:0 if i,%class.Properties.GetAt(i).Name="Status" quit
Eduard Lebedyuk · Mar 29, 2020 go to post

Do not specify a timeout or specify a longer timeout.

In your example if the response is taking more than 15 seconds the sync activity will complete

Here's a minimal example for you. BP sends 2 async calls and waits for them in sync activity:

And Visual Trace looks like this:

To test:

  1. Download code here.
  2. Import and compile.
  3. Open and start production.
  4. Send Ens.Request test request to BP.
Eduard Lebedyuk · Mar 27, 2020 go to post

My preferred approach is using a Query class element.

Here's how it can look like:

Class Sample.Person Extends %Persistent
{

Property Name As %String;

Query ByName(name As %String = "") As %SQLQuery
{
SELECT ID, Name
FROM Sample.Person
WHERE (Name %STARTSWITH :name)
ORDER BY Name
}

ClassMethod Try(name)
{
  set rset = ..ByNameFunc(name)
  do rset.%Display()
}

}

Short and concise.