Gettin Null response in calculation
AnsweredI have a calculation field that is taking 2 txt boxes and pulling them together. If one of those fields is blank then I get a Null return in the calculated field.
-
http://puu.sh/a1Z83/039d3890bb.png
var MyString = @MyTextField;
if (!MyString) {
MyString = "";
}
MyString; -
I need some help with this exact same thing, but I know no javascript at all. I am completely unfamiliar with the syntax other that what I've seen here. I have this in my calcuation field:
@Salutation + @Frist Name + @Last Name + @Suffix
Of course if the Salutation and Suffix fields are empy, it outputs this: null John Doe null
Can you share with me exactly what javascript to place in the calculation field to remove null for empty fields?
Thanks.
-
I am trying to do the same as Robert with one small difference. I will always have a TP Last Name and TP First Name, however the SP First name is really the only variable. This calc leaves "AND" at the end in all cases. I only want it to appear and separte TP First Name and SP First Name if SP First Name actually exists.
result = (@TP Last Name ? @TP Last Name : "");
result+=", "+(@TP First Name ? @TP First Name:"");
result+=" AND "+(@SP First Name ? @SP First Name:"");Thank you
-
Hi Joshua,
this should work:
var tpLast = @TP Last Name ? @TP Last Name : "";
var tpFirst = @TP First Name ? ", " + @TP First Name : "";
var spFirst = @SP First Name ? " AND " + @SP First Name : "";
tpLast + tpFirst + spFirstOr shorter, cause you always have tpLast and tpFirst:
var spFirst = @SP First Name ? " AND " + @SP First Name : "";
@TP Last Name + ", " + @TP First name + spFirstRainer
-
I've also got an issue which is similar to your problem and the solutions below don't seem to fit what I'm trying to do.
I have a Calculation field at the top of my contact app Called Contact. Below this I have 2 text fields 1 called Company name and another called Customer Name.
What I want to happen is that if there isn't a company name, the contact calculation will only show the customer name but if there is a company name as well as a customer name I only want the Company name to show in the contact calculation.
I need this to show right as when I ping the details over to Xero, it's been sending over the Company Name - Customer name which is making xero create the customer as a new contact as the name is different.
Does that make sense? :)
Please sign in to leave a comment.
Comments
15 comments