im noticing weird behaviour using few api methods. The idea is to delete measure from specific document and then recreate if.
Here is the workflow im following:
* Using the Engine API Explorer im invoking the GetMeasure method and copy the string for the returned generic object. ( Im using the Executive Dashboard so you can check with measure id = bUft)
* DeleteMeasure - with id bUft
* CreateMeasure - pasting the generic object from step 1
* at this point im expecting to have exactly the same measure and the api returns almost exactly the same object. The only difference is that the new "imported" measure have a different id. For example "95ddc165-9a5d-42a4-a1cb-337e36511fd4" instead "bUft"
* try GetMeasure again with id = bUft - the api returns null
After this im trying:
* invoke DoSave() method
* refresh the page with the api explorer
* check the GetMeasure again - still null
* try CreateMeasure again
* the measure is created with the correct id (bUft)
Interesting bit is that this is happening with Measures, Dimensions and MasterObjects. For the other objects ( like sheets, snapshots etc.) this is not the case. Deleting the object and recreating it right after this (without invoking DoSave or SaveObjects methods) is creating exactly the same objects.
Desktop or Server? You can't have multiple objects with the same IDs in a QVF so when you delete the object and then right after try to create a object with the same ID most likely the ID has not been free'd up yet.
If you are on Desktop I would suggest you call a DoSave to persist the ID changes and free up available ones.
One problem is that if you try to create an object with an ID that Sense Engine thinks already exists, the engine will simply assign another ID. You should get the ID in the reply, documentation here.
Since you are recreating an app this is bad news: visualizations using the measure will probably refer to it by the old id. It would probably be safer to check if the measure already exists, and in that case modify it.
Erik Wetterberg https://extendingqlik.upper88.com/
Yes this is the case. But think that something somewhere is wrong. Because I don't have this issue with other object types (masterobjects, sheets etc) following the same workflow.
With other object types I can delete and then create the object and the result is new object with the correct id (not self generated one). With dimensions im deleting the object, check if it exists and the engine return false, create the dimension and the id is new (seems that the object still exists) which for me is not normal.
Since I don't know what is modified I need to compare the old and the new object and then update only the different properties which applied to all object types might be pretty tricky task. For this reason I went with "delete-create" approach.
I'm kinda convinced myself that this is due to some issue with the API or for this object types different workflow need to be followed.