Hi All,
Before returning the data of a custom attribute of a requirement, I’m trying to check that the attribute actually has some data to return. Using the M2Doc Interpreter and entering the following command where “selection” is a requirement, it returns the number of characters in the attribute, as expected.
selection.ownedAttributes->filter(Requirements::StringValueAttribute)->select(a | a.definition.ReqIFLongName = ‘reqtRationale’).value.size()
However, if I try to compare that value to a number e.g. “<> 0”, it doesn’t matter what the size is (0 or non-0), the condition always returns “true”.
I also notice the comparison on the size() function is not giving me many options which makes me think I’m not returning an appropriate value to do a comparison with
- Could someone explain why this is happening?
- Assuming there is an easy fix to this problem, is this a sensible approach to checking if the attribute is empty or not?