I've been wrestling with this for a couple of days so wanted to get a sanity check that I'm even approaching it the right way. I've a requirement to color a traffic light green/yellow/red in a UI component based on the value of a BEX exception:
The exception works great ... the crosstab in Design Studio shows the correctly colored cells. However, I have been unable to implement this properly using script contributions (ZTL) and the getConditionalFormatValueExt() method. I couldn't identify another method for retrieving the BEX exception value from the object other than using a script like this:
DS_1.getConditionalFormatValueExt("00733D6SQ53WODKEN1C53S73O",
{
"SBOP2_D05": "KIDS_CARS",
"0UNIT": "PC",
"0CURRENCY": "EUR"
}
);
This script works properly but I found that implementing this in my SDK component was a lot harder! I managed to capture the properties in a for loop that iterates over all of the hierarchy node members and I'm generating the correct pieces individually (just a quick excerpt from Chrome developer tools):
I had hoped to call the script contribution function for each member, thus attaching a property d.color that I could use when rendering the component above (just a simple function to return a color based on the number returned by the conditional formatting call):
this.trafficLight = this.getDataSource().getConditionalFormatValueExt(this.getExceptionKF(), this.getConditionalFormatMultiDim());
The problem I have not been able to overcome is that whenever I fire the properties necessary to build the conditional formatting MultiDim parameter, I have to make them available for BIAL usage:
that.firePropertiesChangedAndEvent(["driver1Key", "driver2Key", "currentMember", "conditionalFormatMultiDim"], "setTrafficLight");
As soon as I do that, Design Studio automatically fires off an afterUpdate() function and I get into a nasty recursion loop that I can't escape from!
So my questions are:
1. Is there a better way I should be trying to implement conditional formatting based on a BEX exception in a custom component?
2. Can you think of any ideas to escape my recursion situation?
The only other idea I have at the moment is to somehow build an array of the conditional formatting values in advance and pass that array instead of trying to build it individually for each member after an update. This would require a ton of code refactoring so I wanted to touch base here first.
