Difference between revisions of "FieldJavaScripting"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
(Created page with '= Calc: Formula = Executing Javascripts client AND serverside NOTE: This feature is currently BETA, and features are subject to change. Properties * Type: [[Field type referenc…')
 
m (17 revisions imported)
 
(16 intermediate revisions by one other user not shown)
Line 1: Line 1:
= Calc: Formula =
= Calc: JavaScript =
Executing Javascripts client AND serverside
Executing Javascripts client AND serverside


NOTE: This feature is currently BETA, and features are subject to change.
NOTE: '''This feature is currently BETA, and features are subject to change.'''


Properties
Properties
Line 12: Line 12:


== User interface ==
== User interface ==
Field in show mode
[[File:FieldJavaScripting_show.png]]
Due to its nature this field has no special editing mode.
Due to its nature this field has no special editing mode.
User interface as displayed in picture


== Configuration ==
== Configuration ==
This field requires configuration before deployment.
This field requires configuration before deployment.


[[File:FieldJavaScripting_BE.png]]
Edit the values using "Manual edit" feature


Required:
Required:
* [[Complex_formulas|Syntax help for the formulas]]
* Functional JavaScript (Configuration1)


Options:
Options:
* ''As shown above''
* None (yet)
 
 
==== Help for syntax ====
The API currently supports the following language features
* All standard functions from JavaScript
** Librarys like Math
* Support for basic TS form functions
** getValue( variable )
** setValue( variable, valueToAssign )
* '''Unsupported''' features include
** JQuery commands (clientside only)
** JavaScript IO functions like '''alert''' and '''input'''
** JavaScript DOM objects like '''window''' and '''document'''
 
==== Important notice ====
 
Some field values are represented differently server and client side, namely date and decimal values
 
{|
!Field
!Client side example
!Server side format
|-
|Date
|31/1/2014
|2014-01-31
|-
|Decimal
|1,23
|1.234
|}
 
Future versions will include these methods callable server and clientside
* getValueDate( fieldname )
* getValueDecimal( fieldname )
* getDateFromString( string )
* getDecimalFromString( string )
 
==== Example ====
 
  if( getValue('NUMBER2') > 1000 )
    setValue('NUMBER1',  Math.round( 100 * Math.random() ) );


== Developer info ==
== Developer info ==

Latest revision as of 11:51, 10 December 2021

Calc: JavaScript

Executing Javascripts client AND serverside

NOTE: This feature is currently BETA, and features are subject to change.

Properties

  • Type: Complex
  • Groupable: No
  • Show in lists: No
  • Searchable: No


User interface

Due to its nature this field has no special editing mode.

Configuration

This field requires configuration before deployment.

Edit the values using "Manual edit" feature

Required:

  • Functional JavaScript (Configuration1)

Options:

  • None (yet)


Help for syntax

The API currently supports the following language features

  • All standard functions from JavaScript
    • Librarys like Math
  • Support for basic TS form functions
    • getValue( variable )
    • setValue( variable, valueToAssign )
  • Unsupported features include
    • JQuery commands (clientside only)
    • JavaScript IO functions like alert and input
    • JavaScript DOM objects like window and document

Important notice

Some field values are represented differently server and client side, namely date and decimal values

Field Client side example Server side format
Date 31/1/2014 2014-01-31
Decimal 1,23 1.234

Future versions will include these methods callable server and clientside

  • getValueDate( fieldname )
  • getValueDecimal( fieldname )
  • getDateFromString( string )
  • getDecimalFromString( string )

Example

 if( getValue('NUMBER2') > 1000 )
   setValue('NUMBER1',  Math.round( 100 * Math.random() ) );

Developer info

  • FeltTypeID: 83
  • SQL datatype: n/a
  • Class name: FieldJavaScripting
  • Field is ignored in tables