Jump to content

Calculation for creating code names from the first 2 characters from several fields


This topic is 5502 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hello, Please help me make a calculation that will combine the first or last, 1 or 2 characters from several fields to create a Code Name for an item.

For example:

Season: Fall

Year: 2010

Type: Shirt

Item_ID: 12

Code Name: F10SH12

I've been searching for an answer for an hour and figure that I don't even know where to look. The answer is probably very simple.

Thanks! Heatherrd

Posted

Use the Text functions like Left and Right to grab pieces of the field. Use the ampersand (&) to concatenate the text.

E.g. Left(Season;1) & Right(Year;2) & etc.

I highly recommend that you do NOT use your calculated code as the primary key, i.e. as a field you use to create relationships to other tables. Use an auto-entered serial number for that, and use your calculated code for labeling or whatever you have in mind.

Also, Spring and Summer both start with S but I assume you have a plan for that.

Posted

If the code you require - F10SH12 - is first character of Season; last two of Year; first two of Type; last two of Item_ID then the calc is:

Left (Season; 1)& Right(Year; 2) & Left(Type;2 & RighWords(Item; 1)

This topic is 5502 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.