How to write OCL for an optional derived property?

Discussions about Domain Specific Language customizations

Moderator: Moderators

How to write OCL for an optional derived property?

Postby Axel Scheithauer » Mon May 18, 2020 1:27 pm

I have a Integer derived property with multiplicity 0..1. The derivation mechanism fills it with 0, even when the ocl script returns null. Is there a way to not fill the field? I know, it is possible with JavaScript by just deleting the field. However, there is no deletion in ocl.
Axel Scheithauer
Forum Beginner
Forum Beginner
 
Posts: 73
Posts Rating:0
Joined: Fri May 21, 2010 7:19 am
Location: Hamburg, Germany
Full name: Axel Scheithauer

Re: How to write OCL for an optional derived property?

Postby Axel Scheithauer » Tue May 19, 2020 2:18 am

I now figured out, that it works when the multiplicity is 0..*. Returning null then leaves the field unfilled. Its an ugly workaround, but at least it solves the current problem.
Axel Scheithauer
Forum Beginner
Forum Beginner
 
Posts: 73
Posts Rating:0
Joined: Fri May 21, 2010 7:19 am
Location: Hamburg, Germany
Full name: Axel Scheithauer


Return to DSL

Who is online

Users browsing this forum: No registered users and 1 guest