Case phone number

Hi all,
I was trying to enabel case phone number for automatic SMS.
I use a case ID: phone_number (long number) as input and used another data
node contact_phone_number (new phone ID).
Does any one know how to add the the country code in front of a number with
leading zero?. I need help.
Thanx

··· -- -Emeka-

Hi Emeka,

Typically what we do is we have one input for the phone number called
contact_phone_number which is a Long Number, and we instruct the users to
input the phone number in international format, including country code.

If that's not possible, you can have two fields as you mentioned, one being
the phone_number which is a Long Number, and the other being the
contact_phone_number which is a Data Node whose calculate condition is
something similar to: concat('256', /data/phone_number) This would add the
country code 256 to the phone number, and since phone_number is a Long
Number, any leading zeroes would automatically be ignored. For example, if
phone_number was '0713...' then the result would be '256713...'. But this
only works if the leading zero is only used for local formatting and the
actual phone number won't ever start with a zero (which is true in some
countries for numbers that you sms to, though not sure if it applies in
your case or not).

Let me know if either of these two solutions would work for your case,
otherwise there might be some other (more complicated) options.

Thanks,
Giovanni

··· On Wed, Feb 27, 2013 at 6:39 AM, Emeka Chukwu wrote:

Hi all,
I was trying to enabel case phone number for automatic SMS.
I use a case ID: phone_number (long number) as input and used another data
node contact_phone_number (new phone ID).
Does any one know how to add the the country code in front of a number
with leading zero?. I need help.
Thanx

-Emeka-

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Giovanni,
Thank you, I have used concat('234' , /data/phone_number) and it gives me
something like: 2348.50977889E8 which is not a usable phone number. And the
second option of having the users enter in international format, might be
difficult to pass as the users are low literate users and would require a
level of training to get them to. I would be willing to learn about the 3rd
method to try out.
Thank you

··· On Wed, Feb 27, 2013 at 4:09 PM, Giovanni Capalbo wrote:

Hi Emeka,

Typically what we do is we have one input for the phone number called
contact_phone_number which is a Long Number, and we instruct the users to
input the phone number in international format, including country code.

If that's not possible, you can have two fields as you mentioned, one
being the phone_number which is a Long Number, and the other being the
contact_phone_number which is a Data Node whose calculate condition is
something similar to: concat('256', /data/phone_number) This would add the
country code 256 to the phone number, and since phone_number is a Long
Number, any leading zeroes would automatically be ignored. For example, if
phone_number was '0713...' then the result would be '256713...'. But this
only works if the leading zero is only used for local formatting and the
actual phone number won't ever start with a zero (which is true in some
countries for numbers that you sms to, though not sure if it applies in
your case or not).

Let me know if either of these two solutions would work for your case,
otherwise there might be some other (more complicated) options.

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 6:39 AM, Emeka Chukwu emeka2015@gmail.com wrote:

Hi all,
I was trying to enabel case phone number for automatic SMS.
I use a case ID: phone_number (long number) as input and used another
data node contact_phone_number (new phone ID).
Does any one know how to add the the country code in front of a number
with leading zero?. I need help.
Thanx

-Emeka-

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
-Emeka-

Hi Emeka,

Where do you see the number in that format? I tried to replicate the
format issue with other 12-digit phone numbers, but they look good to me in
both the case export and case data screens. Can you confirm what the
number looks like in the case data screen (Reports -> Case List -> Then
click on the case).

Also, if you still see the issue, can you try using this expression:
concat('234', string(/data/phone_number))

Thanks,
Giovanni

··· On Wed, Feb 27, 2013 at 11:24 PM, Emeka Chukwu wrote:

Giovanni,
Thank you, I have used concat('234' , /data/phone_number) and it gives me
something like: 2348.50977889E8 which is not a usable phone number. And the
second option of having the users enter in international format, might be
difficult to pass as the users are low literate users and would require a
level of training to get them to. I would be willing to learn about the 3rd
method to try out.
Thank you
On Wed, Feb 27, 2013 at 4:09 PM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Typically what we do is we have one input for the phone number called
contact_phone_number which is a Long Number, and we instruct the users to
input the phone number in international format, including country code.

If that's not possible, you can have two fields as you mentioned, one
being the phone_number which is a Long Number, and the other being the
contact_phone_number which is a Data Node whose calculate condition is
something similar to: concat('256', /data/phone_number) This would add the
country code 256 to the phone number, and since phone_number is a Long
Number, any leading zeroes would automatically be ignored. For example, if
phone_number was '0713...' then the result would be '256713...'. But this
only works if the leading zero is only used for local formatting and the
actual phone number won't ever start with a zero (which is true in some
countries for numbers that you sms to, though not sure if it applies in
your case or not).

Let me know if either of these two solutions would work for your case,
otherwise there might be some other (more complicated) options.

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 6:39 AM, Emeka Chukwu emeka2015@gmail.comwrote:

Hi all,
I was trying to enabel case phone number for automatic SMS.
I use a case ID: phone_number (long number) as input and used another
data node contact_phone_number (new phone ID).
Does any one know how to add the the country code in front of a number
with leading zero?. I need help.
Thanx

-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
-Emeka-

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Emeka,

Sorry about the confusion, here.

Long Number isn't the right datatype for storing this data. There's a Phone
Number/ID datatype you can use for storing numbers which are structured as
strings.

Additionally, make sure that any manipulations you do to the string are
going into a data node of type String (not number).

-Clayton

··· On Thu, Feb 28, 2013 at 10:10 AM, Giovanni Capalbo wrote:

Hi Emeka,

Where do you see the number in that format? I tried to replicate the
format issue with other 12-digit phone numbers, but they look good to me in
both the case export and case data screens. Can you confirm what the
number looks like in the case data screen (Reports -> Case List -> Then
click on the case).

Also, if you still see the issue, can you try using this expression:
concat('234', string(/data/phone_number))

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 11:24 PM, Emeka Chukwu emeka2015@gmail.comwrote:

Giovanni,
Thank you, I have used concat('234' , /data/phone_number) and it gives me
something like: 2348.50977889E8 which is not a usable phone number. And the
second option of having the users enter in international format, might be
difficult to pass as the users are low literate users and would require a
level of training to get them to. I would be willing to learn about the 3rd
method to try out.
Thank you
On Wed, Feb 27, 2013 at 4:09 PM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Typically what we do is we have one input for the phone number called
contact_phone_number which is a Long Number, and we instruct the users to
input the phone number in international format, including country code.

If that's not possible, you can have two fields as you mentioned, one
being the phone_number which is a Long Number, and the other being the
contact_phone_number which is a Data Node whose calculate condition is
something similar to: concat('256', /data/phone_number) This would add the
country code 256 to the phone number, and since phone_number is a Long
Number, any leading zeroes would automatically be ignored. For example, if
phone_number was '0713...' then the result would be '256713...'. But this
only works if the leading zero is only used for local formatting and the
actual phone number won't ever start with a zero (which is true in some
countries for numbers that you sms to, though not sure if it applies in
your case or not).

Let me know if either of these two solutions would work for your case,
otherwise there might be some other (more complicated) options.

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 6:39 AM, Emeka Chukwu emeka2015@gmail.comwrote:

Hi all,
I was trying to enabel case phone number for automatic SMS.
I use a case ID: phone_number (long number) as input and used another
data node contact_phone_number (new phone ID).
Does any one know how to add the the country code in front of a number
with leading zero?. I need help.
Thanx

-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
-Emeka-

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Emeka,

Let us know if using this expression works for
contact_phone_number: concat('234', string(/data/phone_number))

If that still does not work, here's another solution:

  1. Change the datatype of "phone_number" to "Text Question".

  2. Make the Validation Condition for "phone_number" be this: regex(.,
    "^0\d+$")
    (This will ensure that only digits are input, and that the first digit is a

  1. I believe this would be the correct local formatting of the phone
    number, but correct me if wrong?)
  1. Make the Constraint Message for "phone_number" be something similar to
    "Please enter digits only, starting with 0".

  2. Then the Calculate Condition for "contact_phone_number"
    becomes: concat("234", substr(/data/phone_number, 1))
    (This will strip the leading zero for international format, so that a
    phone_number of 080... becomes 23480...)

Thanks,
Giovanni

··· On Fri, Mar 1, 2013 at 1:03 PM, Clayton Sims wrote:

Emeka,

Sorry about the confusion, here.

Long Number isn't the right datatype for storing this data. There's a
Phone Number/ID datatype you can use for storing numbers which are
structured as strings.

Additionally, make sure that any manipulations you do to the string are
going into a data node of type String (not number).

-Clayton

On Thu, Feb 28, 2013 at 10:10 AM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Where do you see the number in that format? I tried to replicate the
format issue with other 12-digit phone numbers, but they look good to me in
both the case export and case data screens. Can you confirm what the
number looks like in the case data screen (Reports -> Case List -> Then
click on the case).

Also, if you still see the issue, can you try using this expression:
concat('234', string(/data/phone_number))

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 11:24 PM, Emeka Chukwu emeka2015@gmail.comwrote:

Giovanni,
Thank you, I have used concat('234' , /data/phone_number) and it gives
me something like: 2348.50977889E8 which is not a usable phone number. And
the second option of having the users enter in international format, might
be difficult to pass as the users are low literate users and would require
a level of training to get them to. I would be willing to learn about the
3rd method to try out.
Thank you
On Wed, Feb 27, 2013 at 4:09 PM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Typically what we do is we have one input for the phone number called
contact_phone_number which is a Long Number, and we instruct the users to
input the phone number in international format, including country code.

If that's not possible, you can have two fields as you mentioned, one
being the phone_number which is a Long Number, and the other being the
contact_phone_number which is a Data Node whose calculate condition is
something similar to: concat('256', /data/phone_number) This would add the
country code 256 to the phone number, and since phone_number is a Long
Number, any leading zeroes would automatically be ignored. For example, if
phone_number was '0713...' then the result would be '256713...'. But this
only works if the leading zero is only used for local formatting and the
actual phone number won't ever start with a zero (which is true in some
countries for numbers that you sms to, though not sure if it applies in
your case or not).

Let me know if either of these two solutions would work for your case,
otherwise there might be some other (more complicated) options.

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 6:39 AM, Emeka Chukwu emeka2015@gmail.comwrote:

Hi all,
I was trying to enabel case phone number for automatic SMS.
I use a case ID: phone_number (long number) as input and used another
data node contact_phone_number (new phone ID).
Does any one know how to add the the country code in front of a number
with leading zero?. I need help.
Thanx

-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you all,
The formula worked perfect and displays as expected in the case properties
and report. But, just one more question.
The contact_phone_number, which format is recommended to receive reminder
SMS? is it 2348047768638 or +2348047768638. I currently format it as
2348047768638.
Thank you

··· On Fri, Mar 1, 2013 at 7:03 PM, Clayton Sims wrote:

Emeka,

Sorry about the confusion, here.

Long Number isn't the right datatype for storing this data. There's a
Phone Number/ID datatype you can use for storing numbers which are
structured as strings.

Additionally, make sure that any manipulations you do to the string are
going into a data node of type String (not number).

-Clayton

On Thu, Feb 28, 2013 at 10:10 AM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Where do you see the number in that format? I tried to replicate the
format issue with other 12-digit phone numbers, but they look good to me in
both the case export and case data screens. Can you confirm what the
number looks like in the case data screen (Reports -> Case List -> Then
click on the case).

Also, if you still see the issue, can you try using this expression:
concat('234', string(/data/phone_number))

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 11:24 PM, Emeka Chukwu emeka2015@gmail.comwrote:

Giovanni,
Thank you, I have used concat('234' , /data/phone_number) and it gives
me something like: 2348.50977889E8 which is not a usable phone number. And
the second option of having the users enter in international format, might
be difficult to pass as the users are low literate users and would require
a level of training to get them to. I would be willing to learn about the
3rd method to try out.
Thank you
On Wed, Feb 27, 2013 at 4:09 PM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Typically what we do is we have one input for the phone number called
contact_phone_number which is a Long Number, and we instruct the users to
input the phone number in international format, including country code.

If that's not possible, you can have two fields as you mentioned, one
being the phone_number which is a Long Number, and the other being the
contact_phone_number which is a Data Node whose calculate condition is
something similar to: concat('256', /data/phone_number) This would add the
country code 256 to the phone number, and since phone_number is a Long
Number, any leading zeroes would automatically be ignored. For example, if
phone_number was '0713...' then the result would be '256713...'. But this
only works if the leading zero is only used for local formatting and the
actual phone number won't ever start with a zero (which is true in some
countries for numbers that you sms to, though not sure if it applies in
your case or not).

Let me know if either of these two solutions would work for your case,
otherwise there might be some other (more complicated) options.

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 6:39 AM, Emeka Chukwu emeka2015@gmail.comwrote:

Hi all,
I was trying to enabel case phone number for automatic SMS.
I use a case ID: phone_number (long number) as input and used another
data node contact_phone_number (new phone ID).
Does any one know how to add the the country code in front of a number
with leading zero?. I need help.
Thanx

-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
-Emeka-

Hi all,

We actually have a new feature: a "phone number" data type.

So you can ignore steps 1-3, and instead just set your phone number
question to the "phone number" data type

Step 4 should ensure that you remove the leading 0 and prepend the country
code instead.

Thanks,
Amelia

··· On Fri, Mar 1, 2013 at 2:27 PM, Giovanni Capalbo wrote:

Hi Emeka,

Let us know if using this expression works for
contact_phone_number: concat('234', string(/data/phone_number))

If that still does not work, here's another solution:

  1. Change the datatype of "phone_number" to "Text Question".

  2. Make the Validation Condition for "phone_number" be this: regex(.,
    "^0\d+$")
    (This will ensure that only digits are input, and that the first digit is
    a 0. I believe this would be the correct local formatting of the phone
    number, but correct me if wrong?)

  3. Make the Constraint Message for "phone_number" be something similar to
    "Please enter digits only, starting with 0".

  4. Then the Calculate Condition for "contact_phone_number"
    becomes: concat("234", substr(/data/phone_number, 1))
    (This will strip the leading zero for international format, so that a
    phone_number of 080... becomes 23480...)

Thanks,
Giovanni

On Fri, Mar 1, 2013 at 1:03 PM, Clayton Sims csims@dimagi.com wrote:

Emeka,

Sorry about the confusion, here.

Long Number isn't the right datatype for storing this data. There's a
Phone Number/ID datatype you can use for storing numbers which are
structured as strings.

Additionally, make sure that any manipulations you do to the string are
going into a data node of type String (not number).

-Clayton

On Thu, Feb 28, 2013 at 10:10 AM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Where do you see the number in that format? I tried to replicate the
format issue with other 12-digit phone numbers, but they look good to me in
both the case export and case data screens. Can you confirm what the
number looks like in the case data screen (Reports -> Case List -> Then
click on the case).

Also, if you still see the issue, can you try using this expression:
concat('234', string(/data/phone_number))

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 11:24 PM, Emeka Chukwu emeka2015@gmail.comwrote:

Giovanni,
Thank you, I have used concat('234' , /data/phone_number) and it gives
me something like: 2348.50977889E8 which is not a usable phone number. And
the second option of having the users enter in international format, might
be difficult to pass as the users are low literate users and would require
a level of training to get them to. I would be willing to learn about the
3rd method to try out.
Thank you
On Wed, Feb 27, 2013 at 4:09 PM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Typically what we do is we have one input for the phone number called
contact_phone_number which is a Long Number, and we instruct the users to
input the phone number in international format, including country code.

If that's not possible, you can have two fields as you mentioned, one
being the phone_number which is a Long Number, and the other being the
contact_phone_number which is a Data Node whose calculate condition is
something similar to: concat('256', /data/phone_number) This would add the
country code 256 to the phone number, and since phone_number is a Long
Number, any leading zeroes would automatically be ignored. For example, if
phone_number was '0713...' then the result would be '256713...'. But this
only works if the leading zero is only used for local formatting and the
actual phone number won't ever start with a zero (which is true in some
countries for numbers that you sms to, though not sure if it applies in
your case or not).

Let me know if either of these two solutions would work for your case,
otherwise there might be some other (more complicated) options.

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 6:39 AM, Emeka Chukwu emeka2015@gmail.comwrote:

Hi all,
I was trying to enabel case phone number for automatic SMS.
I use a case ID: phone_number (long number) as input and used another
data node contact_phone_number (new phone ID).
Does any one know how to add the the country code in front of a
number with leading zero?. I need help.
Thanx

-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Emeka,

You will need to use 2348047768638 (do not include the +).

Thanks!
Sheel

··· On Sun, Mar 3, 2013 at 11:15 AM, Emeka Chukwu wrote:

Thank you all,
The formula worked perfect and displays as expected in the case properties
and report. But, just one more question.
The contact_phone_number, which format is recommended to receive reminder
SMS? is it 2348047768638 or +2348047768638. I currently format it as
2348047768638.
Thank you

On Fri, Mar 1, 2013 at 7:03 PM, Clayton Sims csims@dimagi.com wrote:

Emeka,

Sorry about the confusion, here.

Long Number isn't the right datatype for storing this data. There's a
Phone Number/ID datatype you can use for storing numbers which are
structured as strings.

Additionally, make sure that any manipulations you do to the string are
going into a data node of type String (not number).

-Clayton

On Thu, Feb 28, 2013 at 10:10 AM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Where do you see the number in that format? I tried to replicate the
format issue with other 12-digit phone numbers, but they look good to me in
both the case export and case data screens. Can you confirm what the
number looks like in the case data screen (Reports -> Case List -> Then
click on the case).

Also, if you still see the issue, can you try using this expression:
concat('234', string(/data/phone_number))

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 11:24 PM, Emeka Chukwu emeka2015@gmail.comwrote:

Giovanni,
Thank you, I have used concat('234' , /data/phone_number) and it gives
me something like: 2348.50977889E8 which is not a usable phone number. And
the second option of having the users enter in international format, might
be difficult to pass as the users are low literate users and would require
a level of training to get them to. I would be willing to learn about the
3rd method to try out.
Thank you
On Wed, Feb 27, 2013 at 4:09 PM, Giovanni Capalbo gcapalbo@dimagi.comwrote:

Hi Emeka,

Typically what we do is we have one input for the phone number called
contact_phone_number which is a Long Number, and we instruct the users to
input the phone number in international format, including country code.

If that's not possible, you can have two fields as you mentioned, one
being the phone_number which is a Long Number, and the other being the
contact_phone_number which is a Data Node whose calculate condition is
something similar to: concat('256', /data/phone_number) This would add the
country code 256 to the phone number, and since phone_number is a Long
Number, any leading zeroes would automatically be ignored. For example, if
phone_number was '0713...' then the result would be '256713...'. But this
only works if the leading zero is only used for local formatting and the
actual phone number won't ever start with a zero (which is true in some
countries for numbers that you sms to, though not sure if it applies in
your case or not).

Let me know if either of these two solutions would work for your case,
otherwise there might be some other (more complicated) options.

Thanks,
Giovanni

On Wed, Feb 27, 2013 at 6:39 AM, Emeka Chukwu emeka2015@gmail.comwrote:

Hi all,
I was trying to enabel case phone number for automatic SMS.
I use a case ID: phone_number (long number) as input and used another
data node contact_phone_number (new phone ID).
Does any one know how to add the the country code in front of a
number with leading zero?. I need help.
Thanx

-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
-Emeka-

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
-Emeka-

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Sheel Shah
Project Manager | Dimagi India
t: +91 1146704670 | m: +91 9560187282