Facility Control

 View Only
  • 1.  Create custom function and return value

    Posted 01-10-2018 11:47

    Hi there! Again!

    So... I am playing around more with DashBoard, and trying to simplify more and more.
    Like creating my own functions by adding an tag under in order to quickly build these blocks in visual logic.

    Now for the most part this works just fine. Getting values from inputs in visual logic, grabbing different paramters there etc, and updating parameters in DashBoard, all of these work just fine.
    But...

    I want to be able to add a function that does some math with two inputs, and then returns a value that can then be used in a set_parameter block in visual logic.
    Like the example below:

    function test(val1, val2) {
       return val1 * val2;
    }


    The above code SHOULD give me back [I]val1 * val2[/I] however when I then try to add this block (test) in visual logic, I'm missing a yellow dot (output) from this block like I would get if I used the regular math -> multiply block (the real application of the function will be more advanced than just a simple multiply of course).

    Is there any way I can create a custom function, that will give me an output value (yellow dot) in visual logic? :)



  • 2.  RE: Create custom function and return value

    Posted 01-10-2018 15:56
    Hi astralsberg.
    You will find that the DashBoard 8.4 Beta posted on the Ross Video website works better for what you are trying to do.

    DashBoard 8.3.1 did not always reliably detect that a function provided a return value - we have fixed this in 8.4.

    Cheers.

    James


    #DashBoard


  • 3.  RE: Create custom function and return value

    Posted 01-10-2018 23:36
    Ohh, ok! Cool!
    I guess I'm a beta tester then... Heh...

    Is there any clues as to when this will be released? Like an ETA? Not asking for a specific date, as I assume you'll release it when it's ready.
    But are we talking weeks? Months? Years?

    I dont mind being a tester, but a stable version is of course to prefer...
    #DashBoard


  • 4.  RE: Create custom function and return value

    Posted 01-11-2018 09:19

    While the return part of custom functions now works as intended I suppose (cool!), it's also safe to say that the beta version is somewhat buggy indeed.
    I now have an issue where I cant use the block "Set Parameter Value" in visual logic.
    Trying to set the value of the parameter 0x9 to test.

    Inserting that block alone gives me the code:
    params.getParam('', '0x9', 0).setValue(test);

    Doing the same with the script palette however gives me the code:
    params.setValue(0x9, 0, '[value]');

    Running the block version gives me the following error in debug window:

    10:15:57:986: OGScript exception in script named >>>anonymousLabelTask<<< with content
    function thisIsTheDashBoardReservedFunctionName() {
    /*********          The line above was added by DashBoard because ogScript tasks are functions.      *********/
    
    
    
    
    /*! block id=1050 !*/
    params.getParam('', '0x9', 0).setValue(test);
    /*!!
     <block id="1050" type="param_setvalue" x="286" y="165" w="318" PARAM="[root, Panel Parameters, prosent (0x9)]" VALUE="test" />
    !!*/
    /*!!<checksum>fb1d74d3209255554fe4dd151bf19a00</checksum>!!*/
    
    
    
    /*********          The lines below were added by DashBoard because ogScript tasks are functions.      *********/
    }
    
    thisIsTheDashBoardReservedFunctionName()
    // This is the end of the ogScript
    
    EXCEPTION MESSAGE:
    org.mozilla.javascript.EcmaError: TypeError: Cannot call method "setValue" of null (anonymousLabelTask#8)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3951)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3929)
        at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3962)
        at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3981)
        at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3998)
        at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2414)
        at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2407)
        at org.mozilla.javascript.gen.anonymousLabelTask_211._c_thisIsTheDashBoardReservedFunctionName_0(anonymousLabelTask:8)
        at org.mozilla.javascript.gen.anonymousLabelTask_211.call(anonymousLabelTask)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3282)
        at org.mozilla.javascript.gen.anonymousLabelTask_211.call(anonymousLabelTask)
        at com.rossvideo.common.oglml.ogscript.task.RunOGScriptTask.interpretScript(RunOGScriptTask.java:88)
        at com.rossvideo.common.oglml.ogscript.task.RunOGScriptTask.run(RunOGScriptTask.java:113)
        at com.rossvideo.common.oglml.ogscript.OGScriptTaskQueue$1.run(OGScriptTaskQueue.java:210)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$500(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at com.rossvideo.common.lnf.rice.util.integration.AwtEnvironment$FilteringEventQueue.dispatchEvent(AwtEnvironment.java:361)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
    --------------------------------------------------------------------------------



    So while, again, I could code it. Sadly it doesnt work in beta either (I know it's a beta, so no worries :) )
    Guess I'll wait for a stable update with the return values in visual logic.

    Thanks again though @jamespeltzer, excellent support as allways!


    #DashBoard


  • 5.  RE: Create custom function and return value

    Posted 01-11-2018 14:03
    Would you be willing to send us your panel as an example? What you're seeing there is another issue we are aware of in some circumstances but isn't one most people should hit while developing a regular custom panel.

    The good news is, it was actually fixed earlier this week and we expect to have an updated beta within the next few days to address it. I'd just like to have your panel to verify that we haven't missed anything else.

    You can send it to me at jpeltzer@rossvideo.com

    Thanks.

    James
    #DashBoard


  • 6.  RE: Create custom function and return value

    Posted 11-05-2018 23:41
    I'm somewhat back on this one @jamespeltzer !

    So, getting custom values into the visual logic blocks/functions is no problem, and getting a value in return is no problem either.
    Now I wanna try and make this even more user friendly for people using it and/or explaining to students at our college.

    Is there a way to build a custom dropdown for these "inputs" in custom functions?
    Just like your ogscript.hide does when you use it in visual logic?

    Now of course you could set a parameter with a dropdown inside dashboard, and then pull that value into the variable to send to the function.
    But if you want it "hard-coded" so to speak... How would I go about this?
    #DashBoard


  • 7.  RE: Create custom function and return value

    Posted 11-06-2018 15:04

    If you want to provide more than a basic method signature for visual logic to use in your functions, you'll need to actually create functions in your API through Visual Logic.

    You would create an and use Visual Logic's "Add Function" to build your function with drop-down lists, spinners, text fields, etc.


    #DashBoard


  • 8.  RE: Create custom function and return value

    Posted 11-06-2018 16:10
    Update: At the moment, this will only work if the function is local to where it is being executed. It will not work with a function created in an and used elsewhere (like a button). We have logged this limitation so it can be addressed in a future release.
    #DashBoard


  • 9.  RE: Create custom function and return value

    Posted 11-07-2018 09:17
    Hmm, ok! Well, that gives me an answer! Not exactly the one I wanted, but that works!
    Thanks again!
    #DashBoard