math operations with embedded data | XM Community
Skip to main content

I tried to calculate BMI using responses on weight and height. Weight is in pounds and I am trying to convert it to kilogram. Similarly, height is in ft and inches and I tried to convert to meters. Then I divided the weight in kg  by height in meter squared to calculate the BMI. I also wrote the code to round the BMI value to one decimal place. Unfortunately, no values copulate in the columns of the embedded data. 

Is there anything I did wrong in the codes? I will appreciate your advice and suggestion to make it work.

 

Secondly, how do I write the code to screen out respondents with BMI less than 30kg/m2? The plan is that as respondents enter their weight and height, the system calculates the BMI and then decide if they qualify for the rest of the survey or not. So, how do I write the codes to screen out respondents based on their BMI calculation?

Thank you.

The piping in the Math operation formula is incorrect. Instead of piping all choices text entry, only pipe the specify field value in formula.


Thank you, Shashi.

What question type would you recommend for the variables? I actually used the form field question type and then I validated to numerical value. Probably that’s the source of the problem. 


Thank you, Shashi.

What question type would you recommend for the variables? I actually used the form field question type and then I validated to numerical value. Probably that’s the source of the problem. 

Yes, using form filed question type is correct approach. Form field question type does provide option to pipe individual field responses, which we need to use while piping in math operations.


I changed the codes as you advised, but still did not work. The values did not show up in the dataset.

Here is the survey part.

Here is the empty field I got in the dataset.

Kindly help me review. 


You tested it by taking the survey after making the changes?


Yes, I did. I published it and use the anonymous link, but did not work.


Please double check if the survey is flowing correctly to the Math option embedded data block before ending. To check this just add test embedded data with value 1 and  check if this embedded data is captured.


I have checked the survey again and again and I think the survey flows good. I also added the embedded data as you suggested. The column was created but the cell is empty. I really do not know what I am doing wrong. Is there anything I need to set on the dashboard? Can someone help me with the codes? This is the only thing that is stopping me from moving forward. Kindly help me. Thank you.


I have checked the survey again and again and I think the survey flows good. I also added the embedded data as you suggested. The column was created but the cell is empty. I really do not know what I am doing wrong. Is there anything I need to set on the dashboard? Can someone help me with the codes? This is the only thing that is stopping me from moving forward. Kindly help me. Thank you.

Is it possible to share the screenshot of full survey flow?


Oh yes. This is it.

 


Can you please also make sure that there is no ‘Skip to end of survey’ in any of the questions.


Oh my God, it worked. Wow, you are a genius. Thank you so much.

The only problem is that if I remove “Skip to end of survey”, people who do not meet the inclusion criteria will still be able to continue with the survey in the second block. How do I avoid this? 

Secondly, how do I screen out those people with less than 30kg/m2 BMI?


2 things to try:

1) Confirming that the Math Operations are generating the expected values. I usually confirm this by using Piped Text within the Survey. So, creating a Block after the Embedded Data Math Operations with a Text/Graphic question that uses Piped Text to display the Embedded Data fields back to you.

2) If you confirm that the Math Operations are generating the expected values and they are just not saving properly to the dataset, I've seen something like the before and it can be resolved by updating the Embedded Data field with itself, like in the below:
 


Edit: Nevermind! Looks like you are on the right track


Oh my God, it worked. Wow, you are a genius. Thank you so much.

The only problem is that if I remove “Skip to end of survey”, people who do not meet the inclusion criteria will still be able to continue with the survey in the second block. How do I avoid this? 

Secondly, how do I screen out those people with less than 30kg/m2 BMI?

 

Could you move your embedded data element to after the screening questions?

You could then add branching/ logic in the survey flow to skip to the end of the survey if respondents screen out based on the BMI (in the survey flow).


Oh my God, it worked. Wow, you are a genius. Thank you so much.

The only problem is that if I remove “Skip to end of survey”, people who do not meet the inclusion criteria will still be able to continue with the survey in the second block. How do I avoid this? 

Secondly, how do I screen out those people with less than 30kg/m2 BMI?

Follow the approach mentioned here to end the survey for disqualified respondents.


Thank you so much, guys. You are the best. Shashi, really appreciate your help.


Hi 

Oh my God, it worked. Wow, you are a genius. Thank you so much.

The only problem is that if I remove “Skip to end of survey”, people who do not meet the inclusion criteria will still be able to continue with the survey in the second block. How do I avoid this? 

Secondly, how do I screen out those people with less than 30kg/m2 BMI?

Hi @Olajide ,

You can follow the below structure  to screen out the people who have BMI less than 30kg/m2.
 

Just replace the condition with your variable name containing  BMI   kg/m2   and compare it with 30(in place of 1)

Hope this resolves your query😊!!


Leave a Reply