Delete Annotations

BillHandelman
New Contributor II

Does anyone know how to delete Annotations? I have a DM step and no matter how I set it, it clears the numeric data but not the annotations. I see code to set an annotation value but do not see any code that will delete annotations.   Any thoughts?  Thank you, Bill

6 REPLIES 6

Henning
Valued Contributor

Hi, the DM step only deletes data. There is no default function do delete annotations the same way.

Here is a post on IdeaStream to include such a feature. If you agree, please like to increase awareness:

Copy Annotations Function - OneStream Community (onestreamsoftware.com)

 

For you, you can write a rule to delete the annotations and use that in a (dynamic) dashboard (if needed). The OneStream support team can also help with this, though this is likely a paid for services (building such a logic).

 

Here is another loosely related post on copying annotations. You could use this to set the annotation text to nothing instead of using it to copy something:

Solved: Query on annotation data copy - OneStream Community (onestreamsoftware.com)

jana_seinige
Contributor

that's a pain, same as copying annotations. you have to write a br and practically loop for all combinations (look on Hennings examples). it's not so diffucult, but you should know your dimensions and where the annotations could possibly be to limit it a bit.

hope OS will create a function for this soon like DM data delete or something easier.

manthangandhi
New Contributor III

Hi Bill,

I faced the similar situation, the approach i took was of claring it from database, since Data Annotations in OneStream are stored in "DataAttachment" application tables. I wrote a quick sql script to delete the annotation data for the required intersections and it was good for me. I know this is not the ideal way one should do it, since manupaliting directly within database can cause issues if not done correctly, but unfortunaltely we don;t see any other way.

This is the simple snippet

DELETE FROM DataAttachment WHERE COL_NAME = [VALUE];

Let me know if you need any additioanl assitance on this.

 

 


@BillHandelman wrote:

Does anyone know how to delete Annotations? I have a DM step and no matter how I set it, it clears the numeric data but not the annotations. I see code to set an annotation value but do not see any code that will delete annotations.   Any thoughts?  Thank you, Bill


 

The other (i.e. safer) way is the one Jana mentioned. Pull the rows from the DataAttachment table, loop through them and use api.Data.SetDataAttachmentText() to set the ones someone wishes to delete to nothing. Then you are only using SQL to query the table content but not manipulate it that way, but relying on OneStream's native Api.

manthangandhi,

Thank you for this suggestion. I think for now, I'm going to build a BR where I identify all the annotations I want to delete and set them to empty or blank. I'm assuming that this will not delete the records from the relational table but will be set them to blank.  Do you see this as a big negative?

@BillHandelman i think you can go ahead with this appraoch.