Question
Michel Bruyère · Sep 30

Portal's category.

Hello,


I’m looking for a way to find out which category of portal a connector belongs to.
I looked at the class ‘Ens.Config.Production’ and ‘Ens.Config.Item’ but without success.


An idea about the ‘ObjectScript’ code to design?

Best Regards.

Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.4 (Build 505_1U) Thu May 28 2020 10:01:40 EDT [HealthShare Modules:Core:15.032.9035 + Linkage Engine:15.032.9035]
00
3 0 11 176
Log in or sign up to continue

Category is indeed stored in Ens.Config.Item.

You can access it through SQL:

SELECT Category from Ens_Config.Item

Or using objects:

DEMO>set confItem=##class(Ens.Config.Item).%OpenId(316)

DEMO>write confItem.Category
Test1

Thank you for your answer.

But what I want to have as a result is: by giving a class name (..%ClassName()) or package name ($CLASSNAME()), the name of the portal category is provided to me.

How to know the ID?

You can query Ens_Config.Item on ClassName:

SELECT ID, Category FROM Ens_Config.Item WHERE ClassName = "EnsLib.HL7.Service.FileService"

But you'll want to keep in mind that a production can have multiple items that use the same class, so this query could return multiple rows all with different categories.

Category applies to the item as it is configured in the production, not to the underlying class it uses.

Hello Michel,

Ens.Config.Item has a Category property. Is that what you are looking for?

sample:

TEST>s item=##class(Ens.Config.Item).%OpenId(244)                            

TEST>zw item
item=4@Ens.Config.Item  ; <OREF>
+----------------- general information ---------------
|      oref value: 4
|      class name: Ens.Config.Item
|           %%OID: $lb("244","Ens.Config.Item")
| reference count: 2
+----------------- attribute values ------------------
|       %Concurrency = 1  <Set>
|        AlertGroups = ""  <Get>
|           Category = "test.cat"
|          ClassName = "Ens.Enterprise.MsgBankOperation"  <Set>
|            Comment = ""
|  DisableErrorTraps = ""
|            Enabled = 0
|         Foreground = 0
|     LogTraceEvents = 0
|               Name = "Ens.Enterprise.MsgBankOperation"  <Get>
|           PoolSize = 1
|           Schedule = ""
+----------------- swizzled references ---------------
| i%ModifiedSettings = ""  <Set>
| r%ModifiedSettings = ""  <Set>
|       i%Production = "TESTPKG.FoundationProduction"
|       r%Production = ""
|         i%Settings = ""
|      i%Settings(1) = $lb($lb("IPAddress","Adapter","127.0.0.1"))
|      i%Settings(2) = $lb($lb("LocalInterface","Adapter",""))
|      i%Settings(3) = $lb($lb("Port","Adapter","9192"))
|      i%Settings(4) = $lb($lb("EnableArchiving","Host","1"))
|      i%Settings(5) = $lb($lb("StayConnected","Adapter","3"))
|         r%Settings = ""  <Set>
|  i%VirtualSettings = ""  <Set>
|  r%VirtualSettings = ""  <Set>
+--------------- calculated references ---------------
| CommentOrClassname   <Get>
|  InactivityTimeout   <Get,Set>
+-----------------------------------------------------

TEST>w item.Category
"test.cat"

Thank you for your answer.

But what I want to have as a result is: by giving a class name (..%ClassName()) or package name ($CLASSNAME()), the name of the portal category is provided to me.

How to know the ID?

Multiple Production Items will use the same class (for example, the HL7 TCP Services/Processes), and categories are a Production Item property. You would need to determine first which items are using that class, then get the categories from those items.

Is that what you're looking to do?

The class can be ' citadelle.labo.bs.FileXmlTransLaboIn ' in COS.

In case of a problem, an email is sent to the IT cell and currently, the category is a parameter of the connector.

Sample code (in French) :

SET msg.Body = msg.Body_"<br/><u>Infos pour le service EAI</u> :<br/>Le connecteur de 'Service' en charge de cette tâche est répertorié dans la catégorie '"_.."Catégorie"_"'.<br/>"

SET msg.Body = msg.Body_"Il se dénomme '"_..%ClassName()_"' et le package/classe : '"_$CLASSNAME()_"'.<br/><br/>"

I want to stop using this parameter.

The EnsLib.* classes don't have inherent categories. You can certainly add a Category property to classes that you create, though.

If this code is being run in FileXmlTransLaboIn, you can get the name of the config item from %Ensemble("ConfigName") and then query based on that.

set configName=%Ensemble("ConfigName")
&sql(SELECT Category INTO :itemCat FROM Ens_Config.Item WHERE Name=:configName)

Thanks.

I will use :

&SQL(SELECT Category INTO :itemCat FROM Ens_Config.Item WHERE Name=:%Ensemble("ConfigName"))

Currently I can find out with this SQL query :

Select Category
From Ens_Config.Item
Where ClassName Like 'citadelle.labo.bs.FileXmlTransLaboIn%'

I would like to do this using the existing classes of 'Ens' or 'EnsLib'.