August 6, 201510 yr Hi all Is there a calculation that can determine whether a layout object's conditional formatting is applied at a given moment? Thx
August 6, 201510 yr Author Nothing major. I have buttons that have conditional formatting. I want to prevent the script running if the condition for the formatting is not met. It would just save me having to have the criteria in both the script and the object's conditional formatting.
August 6, 201510 yr It would just save me having to have the criteria in both the script and the object's conditional formatting. Can you capture the calculation logic into a custom function, and then cite that in both the conditional formatting expression and in a guard clause in your script? That would allow you to maintain the underlying logic in just one place (DRY). Just a thought.
August 6, 201510 yr It would just save me having to have the criteria in both the script and the object's conditional formatting. The best way to do this, IMHO, would be to define a calculation field and use the result both for the conditional formatting and for the script. Or use some layout object to declare a global variable, which you can then use in the same manner. Or perhaps a custom function will do (we know nothing of the nature of the calculation, so...). The alternative using GetLayoutObjectAttribute() would be more complicated, not less - assuming it even works, which I haven't tested. Also keep in mind that a condition may exist, but the window hasn't been refreshed yet. It's best to stay at data level for this type of thing. Edited August 6, 201510 yr by comment
August 6, 201510 yr Author Thanks guys, I'll do an underlying calculation that both the script and formatting can refer to. AFAIK GerLayoutObejctAttributes can't ascertain the type of formatting I'm using. Cheers
August 6, 201510 yr AFAIK GerLayoutObejctAttributes can't ascertain the type of formatting I'm using. We won't know that until you tell us what it is.
August 6, 201510 yr Author We won't know that until you tell us what it is. Good point - the formatting is text, fill and border colour. In the help though, I can't find any attributes within the function that refer to any formatting at all, only dimensions. Did I miss something?
August 6, 201510 yr I can't find any attributes within the function that refer to any formatting at all Well, the "content" attribute returns the field data formatted using the specified object's properties - so I was hoping to use GetAsCSS() to detect the text color. However, testing shows that the color applied by conditional formatting is not included.
Create an account or sign in to comment