Hi,

I think you mean IRIS, not ISIS.

can you give more precisions about the installation ?  Platform ? Distribution ? Firewall somewhere ? 

Thanks everyone, I've read all your answers.


I​​ am using a %DocDB.Database. I have many colons created using %CreateProperty and some of them have the UNIQUE indicator set to true, therefore an index is created.
BUT, the %CreateProperty method is quite limited and I couldn't find how to make indexes on multiple columns/properties without doing some kind of trick (adding a property whose propertyExpression is the combination of other properties).

Anyway, I ended up building some indexes manually like that:

SET className = tfullDatabaseName
SET indexDefinition = ##class(%Dictionary.IndexDefinition).%New()
DO indexDefinition.parentSetObjectId(className)
SET indexDefinition.Name = "col1AndColB"
SET indexDefinition.Properties = "col1,colB"
SET indexDefinition.Unique = 1
SET status = indexDefinition.%Save()


Whenever I want to update my database schema, our strategy is to remove all properties and indexes.
Of course, the original %DropProperty drops indexes associated to the property to drop using an internal server only method dropIndex:
 

/// dropIndex() - delete an index definition and its structure. This method returns an oref referencing the index definition
/// document that was removed from the index definition database.
/// <br>
/// <pre>
/// SAMPLES>set people = $system.DocDB.GetDatabase("People")
/// SAMPLES>set index = people.%DropIndex("HC")
/// SAMPLES>write index.%ToJSON()
/// {"database":"People","name":"HC","type":"bitmap","class":"%DocDB.Server.Index.Bitmap","key":[["HomeCity","string"]]}
/// </pre>

Method dropIndex(indexName As %RawString = "") As %Library.DynamicAbstractObject [ Internal, ServerOnly = 1 ]

{
    TRY {
        SET response = $THIS
        $$$THROWONERROR(status,$CLASSMETHOD(..ClassName,"%PurgeIndices",$LISTBUILD(indexName)))
        $$$THROWONERROR(status,##class(%Dictionary.IndexDefinition).%Delete($$$oidForm(..ClassName_"||"_indexName)))
// check status?

    } CATCH exception {
        SET response = ""
        THROW exception
}
RETURN response
}


By the way, the documentation of this method suggest that you can use %DropIndex ... maybe this is an error.

Note that this instance method is called only within the %DropProperty method, within a TSTART TCOMMIT block and the class is also locked.

About my initial question, my original intent was to drop ALL indexes on the database, even those NOT created with %CreateProperty.
I tried to mimic the code of %DroptProperty (TSTART TCOMMIT, lock class, ...) with no success. When I try to recreate properties and columns for all my %DocDb.Databases it fails randomly.


 

Thanks, this works.
But, my question did not exactly reflect my thoughts, I needed the ID of a class' indices in order to delete them manually since I haven't found any method that would be %RemoveIndices(pIndexList As %List=""...).


So, in order to get the IDs, I use 

SELECT ID
FROM %Dictionary.IndexDefinition
WHERE  parent = 'your.class'

Then we use %DeleteId to delete the found indices. This is not fully tested yet.




 

We are looking forward for Embedded Python ! About the mindset|languages, don't be rude please ! 😚. Whenever a new developer comes in and jumps into ObjectScript, you don't necessarily tell him about this very rule exception when writing arithmetic nor does he think that he should read the documentation SQL/Using SQL/... whilst it's not trivial that is is related. I was just asking about a setting that would make me confident when we deliver our platform to future developers.
I always format my expressions with "(" but for some people this is just some coding style...

Operator precedence in ObjectScript is strictly left-to-right; within an expression operations are performed in the order in which they appear. This is different from other languages in which certain operators have higher precedence than others

I am fine with each language having its own operator precedence, but, is there a setting somewhere, even hidden or activable with some obscur guru command to have the same as pretty much everyone else ?

Problem is solved, it was my fault. I forgot a '.' in one of the many nested calls ...
The thing to remember is to pass the response argument by reference everywhere, from REST to BO1.

Hi,

I don't really get it, I don't understand the flow.

The documentation says :

structure your code to use SendRequestAsync() instead of this method, and handle response messages in the OnResponse() callback method

But I want a synced request.

Set tSC = SendRequestSync(request, .response)
// Now I continue the flow from here ... but you're telling me I should handle in OnResponse() ... but how do I take control right back here if I use OnResponse() +?

The following post (How to - Customize Ensemble Settings) details your answers.
I had not seen it while searching for answers because it didn't show up in the results while typing "settings" in the search field it but it does when typing "customize":

 vs 

Anyway, thank you for your help.

You are right, my calling code is inside a web application, so I need to give the ressource %NSone_SRC to the web application.

Thank you.