Page 1 of 1

How to overlay contact_name on Sms_sender

Posted: 02 Aug 2014 13:55
by sambarlick
Hi guys,

I am trying to work on a flow that shows a message dialog that overlays a contact name instead of the number when i recieve a sms.

I have tried adding a script prior to the execution if the message dialog.

if ($sms_sender == $contact_name)
{
$global_Name =$contact_name;
}

else
{
$global_Name =$sms_sender;
}

I also tried simply instead of the global variable jus calling it Name then copying Name to clip_data then added clip_data to the message dialog. All that clip_data contained was Name and not the variable.

Am i doing something wrong?

Sam

Re: How to overlay contact_name on Sms_sender

Posted: 04 Aug 2014 17:06
by Martin
Hi,

You can directly use the available variables without adding a dollar sign:

Code: Select all

if (sms_sender == contact_name) 
{
  global_Name =contact_name;
}
else
{
  global_Name =sms_sender;
}
I did not understand the overlay part. Do you want to show a notification on screen containing the contact name when available or the number when no name can be found?
Something like this:

Code: Select all

if (contact_name=="") 
{
  text_to_display = sms_sender;
}
else
{
  text_to_display = contact_name;
}
and then:
-action Notification on Screen: {text_to_display}

Regards,
Martin

Re: How to overlay contact_name on Sms_sender

Posted: 05 Aug 2014 04:30
by sambarlick
Thanks Martin,

Yes, i am trying to show a contact name if known if not then show the number on a on Screen notification.

Sam

Re: How to overlay contact_name on Sms_sender

Posted: 06 Aug 2014 12:11
by sambarlick
Hi Martin,

I entered the text as you wrote it, when i receive a text from someone in my phonebook the contact name is displayed, but when i don't have her sms sender in my phonebook the returned value from the if state mentors is null.

Did i do something wrong?

Thanks, Sam

Re: How to overlay contact_name on Sms_sender

Posted: 06 Aug 2014 16:27
by Martin
Hi,

Sorry, the check in the if should test if the variable is not set at all:

Code: Select all

if (contact_name == null) 
{
  text_to_display = sms_sender;
}
else
{
  text_to_display = contact_name;
}
Regards,
Martin

Re: How to overlay contact_name on Sms_sender

Posted: 06 Aug 2014 23:31
by sambarlick
That fixed it.

Thanks Martin, again!