Tuesday, July 26, 2016

Scrambler Update

A couple of weeks ago Cameron pointed out that the scrambler utility has a bug. If i try to save the outline from API, and the outline has warnings (say more than 100 children of dynamic member), it will throw an error and the outline will not be saved.
If you validate from EAS this is what you get:
And if you change the storage type of the problematic parent to “store” then the utility works fine.

In other words, I need to suppress the warning and force it to save the outline anyways.

The solution was rather trivial, and if you use API from time to time you probably know it. But for me it was somewhat counterintuitive, so i decided to post it in case someone gets the same issue.

If you use restructure option
otl.save(IEssCube.EEssRestructureOption.KEEP_ONLY_LEVEL0_DATA);

It automatically does outline verification, and then saves the outline with whatever restructure option. It doesn't have an option to ignore verification errors and save the outline.

I incorrectly assumed that if you could clear all the data and then save the outline without restructure/verification option, like this:

targetCube.clearAllData();
otl.save();

I saw that the verification warning is not displayed, but the outline is not saved either. Again, i incorrectly assumed that is because of the underlying error/warning.
Apparently, the outline did not save because even though i delete all the data, i still need to explicitly issue restructuring command, like this:

otl.save();
otl.restructureCube(IEssCube.EEssRestructureOption.KEEP_ONLY_LEVEL0_DATA);

If you use those two commands instead of previous one, verification errors will be ignored. Pretty simple.