Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Mar 25, 2024 10:52 AM - edited Mar 25, 2024 11:52 AM
I'm new, so apologies for any blatant errors. I'm trying to create a SKU in the table primary field using the SWITCH function based on other fields in the table. My initial try included a lengthy list of colors (all unique) and the 5-letter results (not unique) for output, and the formula failed to even load. Removing the color section, I was able to generate the appropriate results based on the other columns. However, after struggling with the color field and failing, I reset the formula to the original (no color), and now get #ERROR!. I cleaned up and sorted the color entries to perfectly match the fields, and now get #ERROR!, which is progress, I guess, as at least the formula loaded.
Next, I added a lookup field for the color code I want in this table and changed the color SWITCH section to reference the lookup field, but I still get #ERROR!. Here's my new formula:
SWITCH(
{Product Type},
"Apparel", "APP",
"Accessories", "ACC",
"Blankets", "BKT",
"Brock", "BRK",
"Other", "OTH"
) & "-" &
LEFT(
{Blank}, 17
) & "-" &
LEFT(
{Color Code (from Color)}, 5
) & "-" &
LEFT(
{Size}, 3
) & "-" &
RIGHT(
{Autonumber},
"000000" & Autonumber, 7
)
It seems that this should be a simple formula. The referenced fields are all either fields in this table, primary key fields in other linked tables or a lookup field in a linked table (Color). I'm sure I'm missing something very basic, but it eludes me. At this point in a resident program, I would close out the program and restart the computer, but what is the equivalent for an online program?
Thanks for any insights.
Solved! Go to Solution.
Mar 27, 2024 06:53 AM
I tried your formula and get ERROR too
After I corrected mistake with Autonumber and inserted 'add empty string' for lookup, it works. Please check.
Mar 28, 2024 08:11 AM
It worked!!! Thank you! I assumed I needed a field reference for Autonumber just like the others. Any idea why it isn't required when the others are?
Mar 28, 2024 08:12 AM
Thanks for this info. I'll definitely use it for future questions. I appreciate everyone's help!
Mar 28, 2024 11:27 AM
The Autonumber word is a field reference.
RIGHT("000000" & {Autonumber}, 7)
is the same as
RIGHT("000000" & Autonumber, 7)
When the field name consists of a single word, curly braces are not required.