How to create unique student email addresses in query?
First decide what format is needed for the student Email address using First name, middle name, last name, initials, ID numbers, Graduation year, or a combination of these.
These queries show how to use functions such as RIGHT, LEFT, LOWER case for all alpha characters and the Math functions to add the different components together.
This will combine the first two characters of the last name, first two characters of the last name, and the last five characters of the Student ID number.
LIST STU LN FN ID (( LOWER ( LEFT ( LN , 2 ) + LEFT ( FN , 2 ) ) + RIGHT ( ID , 5 ) + "@example.k12.ca.us" )) IF SEM = " "
Result:
Abbott Allan 99400001 abal00001@example.k12.ca.us
This will combine the first character of the first name, middle name, last name and ID number.
LIST STU FN MN LN ID (( LOWER ( LEFT ( FN , 1 ) + LEFT ( MN , 1 ) + LEFT ( LN , 1 ) ) + CAST ( ID AS VARCHAR ) + "@example.k12.ca.us" )) IF SEM = " "
Result:
Allan James Abbott 99400001 aja99400001@example.k12.ca.us
This will combine the first two characters of the last name, first two characters of the last name, and the Student ID number with a period between each.
LIST STU FN LN ID (( LOWER ( FN ) + "." + LOWER ( LN ) + "." + CAST ( ID AS VARCHAR ) + "@example.k12.ca.us" )) IF SEM = " "
Result:
Allan Abbott 99400001 allan.abbott.99400001@example.k12.ca.us
This will combine the two digit Graduation year, first character of the first name, middle name, last name and ID number. Use the current graduation year in place of the 2025.
LIST STU ID NM GR (( RIGHT ( (( 2025 + 12 - GR )) , 2 ) + LOWER ( LEFT ( LN , 1 ) + LEFT ( MN , 1 ) + LEFT ( FN , 1 ) ) + CAST ( ID AS VARCHAR ) + "@example.k12.ca.us" )) IF SEM = " "
Result:
99400001 Allan James Abbott 9 28aja99400001@example.k12.ca.us