Add Custom Functions(
	New Custom Function(
		"custom", 	// namespace in which new function resides
		"x1000", 	/* function name. The completely scoped name is
			"custom:x1000".*/
 
		Function( {x}, x * 1000 ),
		// function definition
		<<Transform Category( 1 )
		// optional message to enables this as a custom transform
	)
);
Figure 8.10 Custom Transform in a Data Table
The last type of custom function is a custom format. You create custom formats using New Custom Function() and by specifying the Custom Format Category(1) message. Here’s an example that multiplies an input variable by 2 and also displays (x2) after the value. Note that, in this example, this function persists as a custom format and in the formula category “My New Category”. This allows you to use the format in a column formula or as a custom format.
// add a New Custom Function, specifying it as a Custom Format
// show "(x2)" after the value in the data table
Add Custom Functions(
	New Custom Function(
		"myNamespace",
		"Times 2",
		Function( {inputVar},
			{Default Local},
			Char( inputVar * 2 ) || " (x2)"
		),
		<<Description( "Multiply input by 2. Display (x2) after the new value." ),
		<<Formula Category( "My New Category" ),
		<<Custom Format Category( 1 )
		// enable this as a custom format
	)
);
By specifying the Custom Format Category(1) message, this format now persists under the Custom Function category in the Format menu. Here’s what this looks like when applying this new Times 2 custom format in the Column Info window:
Figure 8.11 Custom Format in the Col Info Window
Add Custom Functions(
	New Custom Function(
		"myNamespace",
		"DateYMD_Day",
		Function( {inputVar},
			{Default Local},
			Char(
				Match( Month( inputVar ),
					1, "January ",
					2, "February ",
					3, "March ",
					4, "April ",
					5, "May ",
					6, "June ",
					7, "July ",
					8, "August ",
					9, "September ",
					10, "October ",
					11, "November ",
					12, "December "
				)
			) || Char( Year( inputVar ) ) || ", Day#" || Char( Day( inputVar ) ) || "-" ||
			Char(
				Match( Day Of Week( inputVar ),
					1, "Sunday",
					2, "Monday",
					3, "Tuesday",
					4, "Wednesday",
					5, "Thursday",
					6, "Friday",
					7, "Saturday"
				)
			)
 
		),
		<<Description(
			"Date format showing Month, Year, Day and Day of Week \nfor example, April 1930, Day#29-Tuesday"
		),
		<<Custom Format Category( 1 )
	)
);

Help created on 7/12/2018