Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Complemented value list

Complemented value list 21 Feb 2013 08:36 #7818

Hello,

I have a question regarding complemented value list:

Does omit match an complement-list e.g. complement(1,2,3)?
type record myRecord {
  integer field1 optional
}
 
template myRecord tCompl:= {
   field1:=complement(1,2,3)
}
 
var  myRecord vOmit:= {field1:=omit};

What is the result of match(vOmit,tCompl)?
I would expect true.

Best regards,

Martin Hauch
Consultant

[Devoteam Danet GmbH]
Tel.: +49 (0)6151 868-7433
Fax.: +49 (0)6151 868-7264
This email address is being protected from spambots. You need JavaScript enabled to view it.<This email address is being protected from spambots. You need JavaScript enabled to view it.>
Devoteam GmbH, Gutenbergstraße 10, 64331 Weiterstadt, Germany
URL: www.devoteam.de<www.devoteam.de/>
Last Edit: 30 Jul 2013 09:37 by Denis Filatov.
The administrator has disabled public write access.

Complemented value list 21 Feb 2013 10:27 #7819

Hello,

no, it does not. The complement construct (like all constructs except omit,
AnyValueOrNone (*) and the ifpresent matching mechanism) only matches
values and not the absence of values (i.e. omit).

Therefore, if you want to include omit in the set to be matched, use
complement(1,2,3) ifpresent.

Best Regards,

Jacob Wieland
Last Edit: 15 Jul 2013 08:05 by Silvia Almagia.
The administrator has disabled public write access.

Complemented value list 21 Feb 2013 10:41 #7820

Hi Martin,

No, it will not match. Complement list alone means that the field shall be present and the actual VALUE shall be something not present in the list. If you want to allow that your tCompl is also matching when field1 is missing, you shall use ifpresent like
template myRecord tCompl:= {
   field1:=complement(1,2,3) ifpresent
}

In another words, complement and a(n optional) missing field are orthogonal things. While complement is related to the type of a field (integer), optionality is property of the enclosing record/set type (irrespective of the type of the optional field).

BR, Gyorgy
Last Edit: 30 Jul 2013 09:38 by Denis Filatov.
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin