ID value contains all pieces of the primary key separated by ||. In the case of %Dictionary.StorageSQLMapDefinition it's:

Class||Storage||SQLMapName

So to open %Dictionary.StorageSQLMapDefinition you need to either construct an ID like this:

Set Class = "%CSP.Util.Performance"
Set Storage = "CspPerformance"
Set SQLMapName = "Map1"
Set Id = $LTS($LB(Class, Storage, SQLMapName), "||")
Set Obj = ##class(%Dictionary.StorageSQLMapDefinition).%OpenId(Id)

Alternatively you can use Open method for IDKEY index (more on auto-generated methods for indices, properties etc.):

Set Obj = ##class(%Dictionary.StorageSQLMapDefinition).IDKEYOpen(Class, Storage, SQLMapName)

There are several ways to handle this:

  1. Dynamically adjust BP settings (your suggestion). To do that you need to modify object(s) of Ens.Config.Item class and update the production. Check GetItemSettingValue method in Ens.Director class for an example of getting setting value. After that update the production and that's it. The problem with that approach are:
    • Updated settings take effect for all new incoming/outgoing messages
    • Updating production is a time-consuming operation, it should be used as rarely as possible
  2. Proxy process. Add proxy process that calls your target process. The proxy process should only contain logic related to error processing. And the target process should return the message immediately without any error checks.
  3. Modify the process so it does not return an error each time, but rather sleeps and calls the operation again depending on an error.

Code sample for 1 - utility method to search for setting in a production object.

/// Find BH in a current production by a setting value
ClassMethod findConfigItemBySettingValue(settingName As %String, settingValue As %String, businessType As %String = "", enabledOnly As %Boolean = 0) As Ens.Config.Item
{
    #dim sc As %Status
    
    // Get current production object
    #dim prod As Ens.Config.Production = ..getCurrentProduction()
    if '$isObject(prod) quit ""

    // Cycle over production elements
    #dim item As Ens.Config.Item
    #dim result As Ens.Config.Item = ""
    for i = prod.Items.Count():-1:1
    {
        set item = prod.Items.GetAt(i)
        
        // Search only for specified type
        if ((businessType '= "") && (item.BusinessType() '= businessType)) || (enabledOnly && 'item.Enabled) continue
        
        // Cycle over settings
        do item.PopulateModifiedSettings()
        set ind = ""
        for
        {
            set setting = item.ModifiedSettings.GetNext(.ind)
            if (ind = "") quit
            
            // Found it?
            if (setting.Name = settingName)
            {
                if ($ZStrip(setting.Value, "<>W") = $ZStrip(settingValue, "<>W")) set result = item
                quit
            }
        }
        
        if $isObject(result) quit
    }
    
    quit result
}

/// Get current running production object
ClassMethod getCurrentProduction() As Ens.Config.Production
{
    #dim sc As %Status
    #dim prodName As %String
    #dim prodState As %Integer
    
    // Find the name and status of current production
    set sc = ##class(Ens.Director).GetProductionStatus(.prodName, .prodState)
    if $$$ISERR(sc)
    {
        $$$LOGERROR($System.Status.GetErrorText(sc))
        quit ""
    }
    
    //Status should be "Running"
    if (prodState '= $$$eProductionStateRunning) quit ""
    
    // Open object by name
    #dim prod As Ens.Config.Production = ##class(Ens.Config.Production).%OpenId(prodName, , .sc)
    if $$$ISERR(sc)
    {
        $$$LOGERROR($System.Status.GetErrorText(sc))
        quit ""
    }
    
    quit prod
}

Let's say you have this production definition:

Class Passthrough.Production Extends Ens.Production
{

XData ProductionDefinition
{
<Production Name="TEST" LogGeneralTraceEvents="false">
  <Description></Description>
  <ActorPoolSize>2</ActorPoolSize>
  <Item Name="PassthroughOperation" Category="" ClassName="EnsLib.SOAP.GenericOperation" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Adapter" Name="HTTPServer">www.webservicex.net</Setting>
    <Setting Target="Adapter" Name="URL">|</Setting>
  </Item>
  <Item Name="PassthroughService" Category="" ClassName="Passthrough.PassthroughService" PoolSize="0" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Host" Name="TargetConfigName">PassthroughProcess</Setting>
    <Setting Target="Adapter" Name="EnableStandardRequests">1</Setting>
    <Setting Target="Adapter" Name="Port"></Setting>
    <Setting Target="Host" Name="OneWay">1</Setting>
  </Item>
  <Item Name="PassthroughProcess" Category="" ClassName="Passthrough.PassthroughProcess" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Host" Name="TargetConfigName">PassthroughOperation</Setting>
  </Item>
</Production>
}

You can change

<Production Name="TEST"

To any other name.

After recompile, new name should be displayed in SMP.

Seems like ability to parse files directly was introduced after 2016.1 (I tested in 2017.1 and it works. Your initial code works after replacing %From with $from:

 S filename="/tmp/pictures.json"
  S stream=##class(%Stream.FileCharacter).%New()
  S sc=stream.LinkToFile(filename)
  I ('sc) W "Error on linking file "_filename,! W
  try {
    set obj= [].$fromJSON(stream)
  } catch ex {
    w "Error. Unable to parse file "_filename,!
    w "Error type   "_ex.Name,!
    w "Error code   "_ex.Code,!
    w "Error location "_ex.Location,!
    set obj=""
  }
  q obj
  Q 

I would recommend upgrading from 2016.1 to 2017.1.

  1. Copy them into new array with keys = target property value. Iteration over this new array would be ordered as desired. Or when you set your array initially you can set keys = target property value.
  2. Another option is to order by local. Set some local with subscript = target property value, and local value as an oref. Then iterate over the local - you'll get ordered orefs.

1. How do you want to use this partial index?

2. NULL values are indexed, same as any other value (with one difference that any number of NULL values are allowed in  a Unique index). Consider the following example:

Class Sample.Person Extends %Persistent
{

Property Name As %String;

Index NameIndex On Name;

/// do ##class(Sample.Person).Test()
ClassMethod Test()
{
    kill ^Sample.PersonD, ^Sample.PersonI
    do ..AddPerson("ed")
    do ..AddPerson("ed")
    do ..AddPerson("bob")
    do ..AddPerson()
    do ..AddPerson()
    
    zw ^Sample.PersonD, ^Sample.PersonI
}

ClassMethod AddPerson(Name)
{
    set p = ..%New()
    set:$d(Name) p.Name = Name
    do p.%Save()
}

Whn I run the text method:

do ##class(Sample.Person).Test()

I get the following data global:

^Sample.PersonD=5
^Sample.PersonD(1)=$lb("","ed")
^Sample.PersonD(2)=$lb("","ed")
^Sample.PersonD(3)=$lb("","bob")
^Sample.PersonD(4)=$lb("","")
^Sample.PersonD(5)=$lb("","")

And the following index global:

^Sample.PersonI("NameIndex"," ",4)=""
^Sample.PersonI("NameIndex"," ",5)=""
^Sample.PersonI("NameIndex"," BOB",3)=""
^Sample.PersonI("NameIndex"," ED",1)=""
^Sample.PersonI("NameIndex"," ED",2)=""

As you see NULL values are indexed same as any other value.

Index global has the following structure:

^ClassIndexGlobal(IndexName, IndexValue, Id) = DataStoredInIndex

Where:

  • ClassIndexGlobal - is a global  name used for storing class globals. Defined in Storage.
  • IndexName-  is a name of the index
  • IndexValue - is a collated stored value (so "bob" becomes " BOB", and NULL  becomes " "). Some additional info on collation. Documentation.
  • Id - object id
  • DataStoredInIndex - any additional data stored in index. Documenatation.

Also for this SQL:

SELECT ID
FROM Sample.Person
WHERE Name IS NULL

The following plan that uses our index gets generated:

  • Read index map Sample.Person.NameIndex, using the given %SQLUPPER(Name), and looping on ID.
  • For each row:
    •  Output the row.