Perform JavaScript Function

Idea created by AddoKlopman on Dec 18, 2015
    Active
    Score63

    JavaScript is amazingly fast! It can do loop, arrays, data manipulation and numerical calculations much faster than FMcalc. There are already plugins that have a Perform JavaScript, or you could use the web viewer. Both have obvious drawbacks. The perform JavaScript Function would enable the user to write and run JavaScript between the () and return data. Also it would enable awesome custom factions whit whole JavaScript libraries. Fast and simpel functions that filemaker wouldn't be abel to do.

     

    It should also support a way to input data from the FileMaker Database into the javascript. Either through a parameter or a notation. So:

     

    PerformJavaScript ( "JavaScript" ; "Parameter" )

    Or:

    PerformJavaScript ( "

    var time = 8

    var awake = § user::awake § // filemaker data

    while (awake) {

         if ( time === 23 ) {

              return time

              awake = false

         }

         time++

    }" )

     

    So to use a unsupported JavaScript character for instant the § you could swap between filemaker code (FMcalc) and JavaScript code.

    The § is just a idea would like to know some of your thoughts on this.

    There is one problem though.... JavaScript does use the dubbel quote " and the singer quote ' that both have a different purpose. You could use the Base64Decode and the Base64Encode as a work around but it would be preferable if this was not needed.

     

    If for this problem we use a unsupported JavaScript character like § to define javascript code in Filemaker code the calculation would look like this:

     

    PerformJavaScript ( § JavaScript § FileMaker § JavaScript § )

    Demo:

    PerformJavaScript ( §

    var time = 8

    var awake = § user::awake § // filemaker data

    while (awake) {

         if ( time === 23 ) {

              return time

              awake = false

         }

         time++

    } § )

     

    Would like to know some of your thoughts on this too.

    This could also be a great way to support other languages to (html, css, ruby, ex.) and would be a big time saver in the web viewer dialog.