How to overlay contact_name on Sms_sender

Post your questions and help other users.

Moderator: Martin

Post Reply
sambarlick
Posts: 96
Joined: 27 Jul 2014 10:40

How to overlay contact_name on Sms_sender

Post by sambarlick » 02 Aug 2014 13:55

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
Attachments
flow_group_Sms_Received_20140802_234328.xml
(11.44 KiB) Downloaded 709 times

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: How to overlay contact_name on Sms_sender

Post by Martin » 04 Aug 2014 17:06

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

sambarlick
Posts: 96
Joined: 27 Jul 2014 10:40

Re: How to overlay contact_name on Sms_sender

Post by sambarlick » 05 Aug 2014 04:30

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

sambarlick
Posts: 96
Joined: 27 Jul 2014 10:40

Re: How to overlay contact_name on Sms_sender

Post by sambarlick » 06 Aug 2014 12:11

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

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: How to overlay contact_name on Sms_sender

Post by Martin » 06 Aug 2014 16:27

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

sambarlick
Posts: 96
Joined: 27 Jul 2014 10:40

Re: How to overlay contact_name on Sms_sender

Post by sambarlick » 06 Aug 2014 23:31

That fixed it.

Thanks Martin, again!

Post Reply