The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



GenerateFeatNames


Unit: SDL_dstruct
Class: TFeatureMatrix
Declaration: function GenerateFeatNames (Template: string; IxFrom, IxTo, FirstNum, Delta: integer): integer;

The method GenerateFeatNames creates feature names for all features from IxFrom to IxTo. Setting both parameters to zero values affects all currently defined features. The feature names are controlled by a template string (parameter Template) which can contain one or more of the following special expressions in order to insert a sequence number or a time stamp:

Index of the feature <%iN%> Inserts the index of the feature as a decimal number using N places. A positive N fills in leading spaces, a negative N fills in leading zeros. Setting N to 0 does not format the number at all.
Decimal sequence number <%dN%> Inserts consecutive numbers which start with FirstNum and are in/decremented by Delta. The inserted number is a decimal number using N places. A positive N fills in leading spaces, a negative N fills in leading zeros. Setting N to 0 does not format the number at all.
Hexadecimal sequence number <%hM%> Inserts consecutive numbers which start with FirstNum and are in/decremented by Delta. The inserted number is a hexadecimal number using M places (valid range of M: 1..8)
Current date/time <%tFORMAT%> Inserts the current date and time using the format string FORMAT; the format string specifies the date/time format according to the following table (please note that the format characters are case sensitive):

d The one- or two-digit day.
dd The two-digit day. Single-digit day values are preceded by a zero.
ddd The three-character weekday abbreviation.
dddd The full weekday name.
h The one- or two-digit hour in 24-hour format.
hh The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.
m The one- or two-digit month number.
mm The two-digit month number. Single-digit values are preceded by a zero.
mmm The three-character month abbreviation.
mmmm The full month name.
n The one- or two-digit minute.
nn The two-digit minute. Single-digit values are preceded by a zero.
s The one- or two-digit second.
ss The two-digit second. Single-digit values are preceded by a zero.
yy The last two digits of the year (that is, 2001 would be displayed as "01"). Please note that the global variable TwoDigitYearCenturyWindow (declared in Delphis "sysutil" unit) determines the range of years which are interpreted as years of the current century.
yyyy The full year (that is, 2001 would be displayed as "2001").

The function returns the following error codes:

 0 ... everything is OK
-1 ... IxFrom or IxTo is out of range
-2 ... invalid template code

 

Example 1: Assuming that the variable FM is an instance of TFeatureMatrix the statement
  FM.GenerateFeatNames ('Prop <%i0%> [<%thh:nn:ss%>]', 8, 12, 0, 0);
generates the following feature names for the features 8 to 12:
Prop 8 [15:16:30]
Prop 9 [15:16:30]
Prop 10 [15:16:30]
Prop 11 [15:16:30]
Prop 12 [15:16:30]
Example 2: The statement
  FM.GenerateFeatNames ('(<%i%>) Feature <%d-4%>', 8, 11, 7, 48);
creates the following feature names for the features 8 to 11:
(8) Feature 0007
(9) Feature 0055
(10) Feature 0103
(11) Feature 0151



Last Update: 2020-Aug-12