Skip to content

Override and Overtake

Override and overtake are the two ways you can change the code in the layer you are working in. With an override you can add code Pre and Post the call to the underlying layer. With override you can't change the code in the middle of the method. You can also override views.

Overtake is the way to use when you must change the code in the middle of the method or if you can't run the previous layers code. If you carry out an overtake then you also assume ownership for this piece of code. Overtaken methods don't call the other layers code. Overtakes should only be used when no other option exists. You can also overtake views.

See also override and overtake syntax in Developer Studio.

Override of methods/records

Override is the preferable way of making enhancements to code. This means that you add code Pre or Post previous layers code. Override methods must always contain a 'super call'. Also you must always annotate the override with the annotation @Override. You can also override type records, in order to add attributes to the record.

Super Call

The super call is an IFS extension to the PL/SQL language. The super call, calls a method with the same name as the overridden method, in the layer below with the signature replicating what is in the super call.

Below is an example of an override with a super call, and an example of an override of type record:

Overtake of methods

An Overtake is not the IFS preferred way of making enhancements to the code, but does need to be used when you cannot carry out an override. When you overtake a method you can rewrite the method so it behaves in exactly the way you want. You must always annotate the overtake with the annotation @Overtake [layer], where layer is the layer that you have overtaken the method from.

Example of an overtake of Base:

Original code:

[Override and Overtake of columns](override_overtake_of_columns)

If you are declaring new views in the view file, with column names that have already been used, you automatically get the same properties on each column as the base, core or extension column have. If you want to change only parts of the properties, but keep the rest, you can re-declare, or override, the column. In this context the result will be the same for a re-declare and an override, the redefined properties will be merged with the existing properties.

If you want to clear properties, and not inherit any properties you can choose to overtake the column and redefine the properties.

Please note that re-declare, override or overtake does not change the column definitions for the views declared in previous layer. To change the column properties on views in previous layers you have to override or overtake the view and re-declare the property.

You can also of course add SELECT statement and/or WHERE statement after this if needed.