sal88 Posted August 6, 2015 Posted August 6, 2015 Hi all Is there a calculation that can determine whether a layout object's conditional formatting is applied at a given moment? Thx
sal88 Posted August 6, 2015 Author Posted August 6, 2015 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.
Mark Scott Posted August 6, 2015 Posted August 6, 2015 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.
comment Posted August 6, 2015 Posted August 6, 2015 (edited) 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, 2015 by comment
sal88 Posted August 6, 2015 Author Posted August 6, 2015 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
comment Posted August 6, 2015 Posted August 6, 2015 AFAIK GerLayoutObejctAttributes can't ascertain the type of formatting I'm using. We won't know that until you tell us what it is.
sal88 Posted August 6, 2015 Author Posted August 6, 2015 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?
comment Posted August 6, 2015 Posted August 6, 2015 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.
Recommended Posts
This topic is 3395 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now