JavaScript BMI calculation syntax with javascript inside dynamics calculation syntax in tableau,calculation syntax in sql

I'd like to create a simple BMI calculator (MS Dynamics 2011)

I have 3 fields:

1: persons height (precision 2 - decimal formatted text box)
2. persons weight (precision 2 - decimal formatted text box)
3. BMI result - This field will display the BMI result. (also precision 2 - decimal)

I believe I need to check the oncreate event on both fields 1 & 2, to launch a javascript function to carry out the calculation. However, I am very new to both dynamics and java-script, and need some help.

I think something along these lines could be close. Can someone assist?

function BMICheck()
{
var Bmiresult = weight/(height/100*height/100);
Xrm.Page.getAttribute("new_bmiresulttextbox").setValue((Math.round(Bmiresult*100)/100).toString(    ));

}

I think I understand the logic OK, syntax is my main issue.

Thanks!

Updated answer with javascript:

function BMICheck()
{

var Bmival = Xrm.Page.getAttribute("crm_heightbox_decimal")/("crm_weightbox_decimal")/100*("crm_weightbox_decimal")/100);
 Xrm.Page.getAttribute("crm_bmiresultbox").setValue((Math.round(Bmival*100)/100));

 }
Answer:1

The javascript is ok, except for ToString as Daryl already pointed out. I would add a check for height and weight to prevent null values (the check if is a positive number can be avoided if the fields have a minimum value setting greater than 0.00)

function BMICheck()
{
    var weight = Xrm.Page.getAttribute("new_weight").getValue();
    var height = Xrm.Page.getAttribute("new_height").getValue();
    if (weight != null & height != null) {
        var bmi = weight/(height/100*height/100);
        Xrm.Page.getAttribute("new_bmi").setValue(Math.round(bmi*100)/100);
    }
    else {
        alert("Need to insert Weight and Height!");
    }
}
Answer:2

Your javascript looks fine to me. The .toString() is unnecessary.

A helpful note about javascript and CRM, is to use F12 to debug your javascript in IE. You can set breakpoints and see what exactly is happening.

If it is generating an error, include it in your question.

Answer:3

Let's say I have the following string: var str = "I like barbeque at dawn"; I want pairs of all words which are separated by a space. This can be achieved via the following regular expression: ...

Let's say I have the following string: var str = "I like barbeque at dawn"; I want pairs of all words which are separated by a space. This can be achieved via the following regular expression: ...

  1. regular expression create online
  2. regular expression create
  3. regular expression create string
  4. regular expression create table
  5. regular expression create new line
  6. regular expression create list
  7. regular expression c# create
  8. create regular expression from text
  9. create regular expression from string online
  10. create regular expression javascript
  11. create regular expression online c#
  12. create regular expression pattern online
  13. create regular expression online java
  14. create regular expression in java
  15. create regular expression python
  16. create regular expression online javascript
  17. create regular expression from string javascript
  18. create regular expression online python
  19. create regular expression online php
  20. create regular expression for password

Here's my code: var APP = {} APP.item = function() { var two = function() { return "three"; } return { two: two }; } console.log(APP.item.two); Now, from what I've read, ...

Here's my code: var APP = {} APP.item = function() { var two = function() { return "three"; } return { two: two }; } console.log(APP.item.two); Now, from what I've read, ...

  1. revealing module pattern javascript
  2. revealing module pattern design pattern
  3. revealing module pattern es6
  4. revealing module pattern vs class
  5. revealing module pattern typescript
  6. revealing module pattern jquery
  7. revealing module pattern constructor
  8. revealing module pattern
  9. revealing module pattern vs prototype
  10. revealing module pattern inheritance
  11. revealing module pattern parameters
  12. revealing module pattern disadvantages
  13. revealing module pattern prototype
  14. revealing module pattern init
  15. revealing module pattern extend
  16. revealing module pattern global variables
  17. revealing module pattern public variables
  18. revealing module pattern singleton
  19. revealing module pattern dependencies
  20. revealing module pattern namespace

Is there a way to listen for new sqlsrv data in node.js (or PHP 5.5) without having to poll the database constantly? I am (obviously, I suppose) trying to have mssql notify my application when new ...

Is there a way to listen for new sqlsrv data in node.js (or PHP 5.5) without having to poll the database constantly? I am (obviously, I suppose) trying to have mssql notify my application when new ...

I know this is a somewhat nebulous question but which algorithm would be more efficient and/or "faster"? Searching through a preloaded JavaScript array of names or using the MySQL query "SELECT NAME ...

I know this is a somewhat nebulous question but which algorithm would be more efficient and/or "faster"? Searching through a preloaded JavaScript array of names or using the MySQL query "SELECT NAME ...

  1. what more efficient ac or dc
  2. what's more efficient than led
  3. what more efficient
  4. which is more efficient in converting biomass
  5. which is more efficient recursion or iteration
  6. which is more efficient otto or diesel