Calculating last name from the built-in contact field
I have an App with just the built-in Contact field and an DOB field and need to display the table based on their last name. So I created an Calculated field for it. How do I extract the last name out of the Contact field? @Contact doesn't work. Thanks.

  • @helgeHave a look at the date of Jacquelyn's answer: July 16, 2014 The calculation fields have been introduced some weeks before, in May 2014 (if I remember right). And at that time not all field types have been available in calculation fields. E.g. Contacts have been added a bit later. So for July 16, 2014 Jacquelyn's  answer has been correct.    Rainer
  • Luckily Jacquelyn's answer is incorrect. As Rainer explained the way to get the name from a contact field in a Podio calculation is: @contact.join()
  • Hi Bumble, if I understand you right, you have a contact field/Type Workspace contacts. There must have benn a misunderstanding by Jacquelyn - or by me) - but that contact field is available as a variable in a calculation field., But only the content of Name field. @contact returns the content as an array, you have to parse it to a string bei adding .join() To get the name of the contact you can do: @contact.join() That shows you the name, how it is entered. Normaly "FirstName LastName" or "FirstName MiddleName LastName". The LastName you can extract: var fullname = @contact.join();fullname.substring(fullname.lastIndexOf(" ")); This works fine if there is no suffix like "FirstName LastName, jr." or "FirstName LastName jr.". You can do some checks if there's a suffix.Often a suffix contains a dot or is separated by a comma. fullname = @contact.join();getLastString = fullname.substring(fullname.lastIndexOf(" ") );check = getLastString.indexOf(".") > -1 || fullname.indexOf(",") > -1 ? fullname.substring(0,fullname.lastIndexOf(" ")) : fullname;lastname = check.substring(check.lastIndexOf(" "));lastname.replace(",","") This doesn't cover all possible cases , e.g. for a name entered as "FirstName LastName junior" the result would be "junior" or for "LastName Firstname" = FirstName, but the result for "LastName, FirstName"  would be "LastName" Rainerrg@delos-consulting.com  
  • Has then been any solution to "unsimplifying" the Contacts field and being able to extract a First Name? Every App for contacts I make has to be created seperatly so that I can get First.
This question is closed.