facebook

calulation

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #339595 Reply

    Stu Wade
    Member

    To see the JavaScript for the calculation you need to look in the file Diabetes_custom.js which is in the Diabetes_www sub-folder.
    This file will open in Notepad, but it looks better in Notepad++, or the source editor in MobiOne Test Centre. It is not that different from Visual Basic – the principals are the same, the main differences are the ways in which you extract values from and put values into the various widgets, but they are not really that arcane.

    Enjoy

    P.S. added in edit – I have posted a variant with 2dp output and a vast amount of hopefully helpful comments below.

    Attachments:
    You must be logged in to view attached files.
    #339605 Reply

    philipdk
    Member

    i can see what you have done and some of how you did it,
    but what is confusing me is how did you inject the java
    code into mobione.

    this is what i cant work out

    #339608 Reply

    Stu Wade
    Member

    Ah! Sorry, my fault for not making it clear.

    The JavaScript is invoked by the ‘Calculate’ button in the M1 design. You will see in the Design Centre – if you click on the button, its properties are displayed on the right hand panel. The important part is the Actions section. I have selected ‘Run JavaScript’ for the ‘On Click’ event and in the associated ‘Code:’ window (accessed by clicking the tiny ‘…’ button on the right) I have invoked the _custom.js by the code snippet “return Calculation();”.

    I hope this is now more easy to understand.

    If in your future pages of the development you need to access the computed values of CF & ICR this is facilitated by moving the declaration of these variables outside the function thus making them globals.

Viewing 3 posts - 16 through 18 (of 18 total)
Reply To: calulation

You must be logged in to post in the forum log in