Skip to content

FP sum of values in attributes: value generated with formulas and manually, use of icons #1782

Answered by macmarrum
Illegit asked this question in Help
Discussion options

You must be logged in to vote

In the following code, .value gets you the raw value of the attribute, which in your case is the formula's text.

            def updAttribute = child.attributes.find { it.key == 'upd' }
            return updAttribute ? updAttribute.value : 0

To get the result of the formula evaluation, you can use either .getTransformed() or .findValues

            def updAttribute = child.attributes.transformed.find { it.key == 'upd' }
            return updAttribute ? updAttribute.value : 0

.findVlaues will return a list of Convertible

            def updAttributeList = child.attributes.findValues { key, value -> key == 'upd' }
            return updAttributeList ? updAttributeList[0].num : 0

The above…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Illegit
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants