Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »


 

FUNCTION xpfAddToAggrIfNotInAggr (aggr        :   AGGREGATE OF GENERIC;   
                                  value       :   GENERIC)
                                  inserted    :   BOOLEAN;
                

Use this function to add the given 'value' to the specified aggregate 'aggr' if the aggregate does not have an element with the same value.

The argument 'aggr' can be any type of aggregate except ARRAY. The argument 'value' can be any of the following data types: sdaiINSTANCE, sdaiINTEGER, sdaiREAL, sdaiSTRING and "typed value" of sdaiINTEGER, sdaiREAL, sdaiSTRING


Arguments


TypeNameComment
AGGREGATE OF GENERICaggrIdaggregate of some instances, that requires to be unique
GENERICinstanceIdinstance id of new element 

Return Value


 

TypeNameComment
BOOLEANinserted TRUE if the element was added

Options


 

Example


FUNCTION get_unique_references(referred: GENERIC): SET OF GENERIC;
     LOCAL
         not_unigue_refs : BAG OF GENERIC;
         unigue_refs : SET OF GENERIC;
     END_LOCAL;
     not_unigue_refs := USEDIN(referred,?);
     unigue_refs := [];
     REPEAT i:=1 TO xpfSizeOf(not_unigue_refs);
          IF xpfAddToAggrIfNotInAggr(unigue_refs, not_unigue_refs[i]) THEN
               xpxPrintf('\n%s inserted', not_unigue_refs[i].name);
          END_IF;
     END_REPEAT;
     RETURN(unigue_refs);
END_FUNCTION;

See also 

Filter by label

There are no items with the selected labels at this time.

 

  • No labels