Add and Substraction Question | XM Community
Skip to main content

Hello everyone, I want to add two embedded data. One of the embedded data is a fixed number and the other is the addition of the income from the tasks. I can see the mathematical additon result in console, but not on the qualtrics page. I did not understand why it’s happening. Could someone help me with that?

Thank you in advance.

Best.

 

can you please be more clear?

What I understood is, you can see the result but not how or where the calculation is, am I right?


can you please be more clear?

What I understood is, you can see the result but not how or where the calculation is, am I right?

When I press F12, I see that the two numbers I want to add are added correctly. However, this operation does not display on the qualtrics screen.


As you can see.


I created an embedded data for it. But not working.


I created an embedded data for it. But not working.

You need to follow Math Operations.

I think you forgot about spacing and there seems to be incorrect brackets.

try $e{ e://Field/Total_ECU + e://Field/Guaranteed_Payment }


I created an embedded data for it. But not working.

Make sure Guranteed_payment embedded data is set to number. Under options you can set it. And ensure the syntax is correct for total income.

 


I created an embedded data for it. But not working.

You need to follow Math Operations.

I think you forgot about spacing and there seems to be incorrect brackets.

try $e{ e://Field/Total_ECU + e://Field/Guaranteed_Payment }

I tried it but did not work. Thank you.


I created an embedded data for it. But not working.

Make sure Guranteed_payment embedded data is set to number. Under options you can set it. And ensure the syntax is correct for total income.

 

I set the embedded data as number but it still didn't work. This is the code I use for it: 

Qualtrics.SurveyEngine.addOnload(function() {

    var guaranteedPayment = parseInt("${e://Field/Guaranteed_Payment}");

    var totalECU = parseInt("${e://Field/Total_ECU}");

   

    console.log("Guaranteed_Payment:", guaranteedPayment);

    console.log("Total_ECU:", totalECU);

   

    if (isNaN(guaranteedPayment) || isNaN(totalECU)) {

        console.error("Error: Embedded data values are not valid numbers.");

    } else {

        var totalIncome = guaranteedPayment + totalECU;

       

        Qualtrics.SurveyEngine.setEmbeddedData("Total_Income", totalIncome);

        console.log("Total Income saved:", totalIncome);

    }

});


Is this question and Embedded are in the same branch. If its,  move the embedded data and Total income calculation after the branch.


Is this question and Embedded are in the same branch. If its,  move the embedded data and Total income calculation after the branch.

Thank you. Solved it.