In Javascript, how to remove scientific notation from embedded field's result? | XM Community
Solved

In Javascript, how to remove scientific notation from embedded field's result?

  • 29 October 2018
  • 5 replies
  • 141 views

Hello,

When opening the survey B via an individual link, I would like the agent (user) to be able to see the phone number currently saved in a contact list X.

In survey B, the question displays: ${e://Field/PhoneNumber} but it always indicates 4,91609E+12 instead of 4916091234567 by example.

In the right order:
1. Phone number is first sent to Qualtrics via a CSV file in format: 4916091234567 and attributed to customer's answer from survey A.
2. When customer completes the survey A and based on some conditions, a new contact list X is created. At this moment, Qualtrics converts the number to 4,91609E+12.
3. When agent is answering survey B, Qualtrics retrieves the phone number from the contact list X and indicates it as 4,91609E+12. Then the agent is not able to call this customer because the last digits are missing. 4916091234567 should be indicated.
4. If I export the response from customer in survey A, I'll see the phone number in format 4,91609E+12 but if I click on it in Excel, I'll be able to read the full number 4916091234567.

Which code in javascript should I use to prevent Qualtrics from converting the phone number to scientific notation?

I hope I was clear, your help will be much appreciated 😉

Thanks a lot!
David
icon

Best answer by Akdashboard 29 October 2018, 22:11

View original

5 replies

Userlevel 7
Badge +33
I would suggest to store it as text value rather than number.
> @bansalpeeyush29 said:
> I would suggest to store it as text value rather than number.

Thanks for the advice. I changed the format of mobile number from "general" to "text" in csv file. When I upload it to create a contact list, the scientific notation comes back and I can't read all digits of the number 😓
Userlevel 7
Badge +6
@David

I think there is something wrong with the way you are thinking about the flow of data. I have had to deal with the problem of scientific notation because of how we generated UID for customers, and always found the issue to be a problem with Excel, not Qualtrics. This is especially true if you are identifying the phone number field as text upon upload, like @bansalpeeyush29 suggested, because text columns come across exactly as they are stated. To do this, btw, you click the "options" button in the embedded data block in your survey flow. Then change "Variable Type" to text.

If you have the phone number in a csv format and then open it in Excel prior to uploading the csv to Qualtrics, then Excel will automatically convert phone number to scientific notation. Basically Excel is trying to be "smart" and it sees your phone number as a large number and it wants to reduce it to scientific notation. If you need to open the file in Excel, I recommend opening a blank Excel and importing the csv as text, then identifying your phone number column as text.
Userlevel 7
Badge +6
> @David said:
> > @bansalpeeyush29 said:
> > I would suggest to store it as text value rather than number.
>
> Thanks for the advice. I changed the format of mobile number from "general" to "text" in csv file. When I upload it to create a contact list, the scientific notation comes back and I can't read all digits of the number 😓

He means to do this in the embedded data field of the survey flow.

!
@Akdashboard

Thank you! It helped me a lot to understand where the issue was coming from.

Indeed, if I don't open the CSV file with Excel, the Scientific notation isn't added.

Leave a Reply