Child pages
  • Utils
Skip to end of metadata
Go to start of metadata



Method Summary
String dateFormat(date, format)
Format a date object to a text representation.
Boolean hasRecords(foundset)
Returns true if the (related)foundset exists and has records.
Boolean hasRecords(record, relationString)
Returns true if the (related)foundset exists and has records.
String numberFormat(number, digits)
Format a number to have a defined fraction.
String numberFormat(number, format)
Format a number to specification.



Method Details

dateFormat

String dateFormat (date, format)
Format a date object to a text representation.

Parameters

{Date} date - the date
{String} format - the format to output

Returns

String - the date as text

Sample

var formattedDateString = utils.dateFormat(dateobject,'EEE, d MMM yyyy HH:mm:ss');
 

hasRecords

Boolean hasRecords (foundset)
Returns true if the (related)foundset exists and has records.
Another use is, to pass a record and qualified relations string to test multiple relations/foundset at once

Parameters

{JSFoundSet} foundset - the foundset to be tested

Returns

Boolean - true if exists

Sample

//test the orders_to_orderitems foundset
if (elements.customer_id.hasRecords(orders_to_orderitems))
{
	//do work on relatedFoundSet
}
//test the orders_to_orderitems.orderitems_to_products foundset to be reached from the current record
//if (elements.customer_id.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
//	//do work on deeper relatedFoundSet
//}
 

hasRecords

Boolean hasRecords (record, relationString)
Returns true if the (related)foundset exists and has records.
Another use is, to pass a record and qualified relations string to test multiple relations/foundset at once

Parameters

{JSRecord} record - A JSRecord to test.
{String} relationString - The relation name.

Returns

Boolean - true if the foundset/relation has records.

Sample

//test the orders_to_orderitems foundset
if (elements.customer_id.hasRecords(orders_to_orderitems))
{
	//do work on relatedFoundSet
}
//test the orders_to_orderitems.orderitems_to_products foundset to be reached from the current record
//if (elements.customer_id.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
//	//do work on deeper relatedFoundSet
//}
 

numberFormat

String numberFormat (number, digits)
Format a number to have a defined fraction.

Parameters

{Number} number - the number to format
{Number} digits - nr of digits

Returns

String - the resulting number in text

Sample

var textalNumber = utils.numberFormat(16.749, 2); //returns 16.75
 

numberFormat

String numberFormat (number, format)
Format a number to specification.

Parameters

{Number} number - the number to format
{String} format - the format

Returns

String - the resulting number in text

Sample

var textalNumber2 = utils.numberFormat(100006.749, '#,###.00'); //returns 100,006.75
 



  • No labels