Error: state constraint violation for 'property'

Hello,

I have been for quite some time stuck on some error, which even after a few times reading through the documentation could not resolve. Below I have put pictures of the code. I would be really grateful, if you could explain and help me resolve the error.

I think this piece of code might help as well:

...
'Total hours': number 'hours' = sum .'R&D hours details'* .'Number of hours worked'
            'Accomplished hours': text
            = switch ^ .'Company information'.'Total planned hours to be accomplished' compare ( .'Total hours' ) (
                | < => "No"
                | >= => "Yes"
            )
        }```

As reference-set holds inverse references. For example, if Orders refer to Products, then you can specify a reference-set on Products that holds the inverse of those references: from Products to Orders, as expressed here.

In your code, you express that you want a reference-set Accomplished hours to hold the inverse of a reference 'Accomplished hours'. But your second piece of code expresses that Accomplished hours is a derived text value. It is not a reference (which are always specified with -> ... or ~> ...).

Some relevant parts of the code are missing in your sample, but if I understand correctly, what you want to express is:

'Company Information': group {
    ...
    'Accomplished hours': number 'hours' 
        = sum ^ .'R&D hours overview'.'R&D hours details'* .'Number of hours worked'
}
1 Like

Thank you for your response, I think I see where is the problem. However, I am trying to actually check whether the ‘Total hours’ are more or equal the ‘Total planned hours to be accomplished’, but since it is not allowed to refer to ‘Total hours’ before defining it in ‘Company information’, I was decided to try with downstream and reference, though I have maybe misunderstood their use cases. Could maybe tell me if there is a way to refer to ‘Total hours’ that are defined in below in another collection and compare them with ‘Total planned hours to be accomplished’ that are in the ‘Company information’ collection?

Can you please clarify what you mean with a code sample that demonstrates what you are trying to do?

Hey, I manage to fix my mistake, nevertheless thank you so much for your help!

1 Like