Apr 24, 2019 09:05 AM
Here is the code I am trying to save but keep getting errors. Any ideas?
IF(OR({Do you have all the Information needed}=“No”,{Do you have all the Material you need}=“No”),CONCATENATE({My Name},“Can’t perform”{Production Goal for the day/Week:})
Solved! Go to Solution.
Apr 24, 2019 02:37 PM
You’re missing a comma after “Can’t perform”, and a closing parenthesis for the IF
function.
A couple more tips:
In your case these tweaks would look like this:
IF(
OR(
{Do you have all the Information needed}="No",
{Do you have all the Material you need}="No"
),
{My Name} & " can’t perform " & {Production Goal for the day/Week:}
)
Apr 24, 2019 02:37 PM
You’re missing a comma after “Can’t perform”, and a closing parenthesis for the IF
function.
A couple more tips:
In your case these tweaks would look like this:
IF(
OR(
{Do you have all the Information needed}="No",
{Do you have all the Material you need}="No"
),
{My Name} & " can’t perform " & {Production Goal for the day/Week:}
)
Apr 24, 2019 02:44 PM
Good tips my brother. I appreciate it.
Apr 25, 2019 06:34 AM
Justin,
What am I missing here: I can’t get the formula to save:
IF(
AND(
{Do you have all the Information needed}=“No”,
{Do you have all the Material you need}=“No”
),
{My Name} & " Needs Information and Material to perform " & {Production Goal for the day/Week:}
IF (
{Do you have all the Information needed}=“Yes”,
{Do you have all the Material you need}=“No”
),
{My Name} & " Needs Material to perform " & {Production Goal for the day/Week:}
IF (
{Do you have all the Information needed}=“No”,
{Do you have all the Material you need}=“Yes”
),
{My Name} & " Needs Information to perform " & {Production Goal for the day/Week:}
)))
Apr 25, 2019 09:08 AM
IF
begins.IF
functions are missing a surrounding AND
for the two comparisons you’re making in each.Here’s the correction:
IF(
AND(
{Do you have all the Information needed}="No",
{Do you have all the Material you need}="No"
),
{My Name} & " Needs Information and Material to perform " & {Production Goal for the day/Week:},
IF (
AND(
{Do you have all the Information needed}="Yes",
{Do you have all the Material you need}="No"
),
{My Name} & " Needs Material to perform " & {Production Goal for the day/Week:},
IF (
AND(
{Do you have all the Information needed}="No",
{Do you have all the Material you need}="Yes"
),
{My Name} & " Needs Information to perform " & {Production Goal for the day/Week:}
)
)
)
Seeing so much repetition in the comparisons you’re making, I also came up with this slightly shorter version:
IF(
OR(
{Do you have all the Information needed}="No",
{Do you have all the Material you need}="No"
),
{My Name} & " Needs " & SWITCH(
{Do you have all the Information needed} & {Do you have all the Material you need},
"NoNo", "Information and Material",
"YesNo", "Material",
"NoYes", "Information"
) & " to perform " & {Production Goal for the day/Week:}
)
Apr 25, 2019 12:32 PM
I like that slightly shorter version. More efficient and thus more elegant. Very inventive too by the way. You are a bad @$$. Thank you sir.
Apr 25, 2019 01:45 PM
Justin,
I modified it a little bit by adding a 3rd condition. However, I do have a question, the below SWITCH did not print to the concatenated sentence. This was the result, “John Doe 3rd Needs to perform Installation of Prefab Headboards.” (He actually needed material)
Here’s the code:
IF(
OR(
{Do you have all the Tooling you need}=“No”,
{Do you have all the Information needed}=“No”,
{Do you have all the Material you need}=“No”
),
{My Name} & " Needs " & SWITCH(
{Do you have all the Information needed} & {Do you have all the Material you need},
"NoNoNo", "Tools, Information and Material",
"YesYesNo", "Material",
"YesNoYes", "Information",
"NoYesNo", "Tools and Material",
"YesNoNo", "Material and Information",
"NoYesYes", "Tools",
"NoNoYes", "Tools and Information"
) & " to perform " & {Production Goal for the day/Week:}
)
Apr 25, 2019 07:26 PM
The SWITCH
function works based on what you feed it in the first argument. In my case, I fed it a concatenated version of the two fields you were originally using for your comparisons. While you added the third field to your OR
check at the beginning, you didn’t add it to the start of the concatenation that SWITCH
checks. In that case, it only mashed together the original two. None of those results are in your list, so it defaults to the equivalent of BLANK()
. To work correctly, the line after the SWITCH
opener should read:
{Do you have all the Tooling you need} & {Do you have all the Information needed} & {Do you have all the Material you need},
Apr 26, 2019 11:39 AM
Thank you much!
Man I should have caught that as I understood what you did when I read the code, but like a newborn learning to crawl… What language are we writing anyway? Is this specific to AirTable? Thank you in advance sir.
Apr 26, 2019 01:19 PM
I don’t think it has a name. Even though the syntax and structure are similar to many other programming languages, the implementation is fairly Airtable-specific in some respects.