Pulling embedded data from contact directory to use in a calculation--is this possible? | XM Community
Skip to main content

Hi,
I want to calculate blood alcohol content (eBAC) in a baseline survey. It requires birth sex, weight, and two alcohol-related items to calculate it.
We gather 'birth_sex' and 'weight' as variables in our screener. A workflow adds participants to our directory and saves these two variables as embedded data to be used later.
In the baseline survey we need to pull in both weight and birth_sex to then use in a calculation with 2 other items (these embedded data are qf_drinks and qf_hours).
So I’m attempting to use the following formula:
$e{ ( ( qf_drinks / 2) * ( birth_sex / ( weight ) ) - ( qf_hours * .016 ) }
Is there any way to do this? I’m not seeing this specific question anywhere. I appreciate your time and expertise, thank you!

Yes, do it like this:
$e{ ( ( e://Field/qf_drinks / 2 ) * ( e://Field/birth_sex / ( weight ) ) - ( e://Field/qf_hours * .016 ) }


Thank you for your reply, Tom.
I'm still seeing "{Invalid Expression}" in the data.
Does it need the spaces removed? I've seen a couple people with similar problems debating if the spaces all need to be removed or not... wondering if that's why it isn't working?

Again thank you for your time and effort, I appreciate it.


You should have spaces between everything. Make sure all your embedded fields are numbers. Also, I didn't check your expression previously, but you have an extra (. Probably the one before weight. Also, weight should be e://Field/weight (I missed that one).


Leave a Reply