Local API - Managing UDFs
UDFs are created differently in each school and the same udf name may refer to something completely different from one school to another. In reports UDFs are referred to by their ID and hence number 3 may be different from school to school.
User defined fields are an additional feature in SIMS where a user can add its own fields with any name provided and attaches it to entities like School, Person [Student/Employee/Contact/Applicant, SEN Student or Agent], Admissions. The user can provide any data type to these fields.
SIMS treats this UDF fields as normal field attach to a entity and hence a 3rd party can write to these fields.
A 3rd party can create their own UDF fields also and write data to them. Below is a sample provided for writing into UDF’s:
EditStudentInformation student = new EditStudentInformation();
foreach (SIMS.Entities.UDFValue udfVal in student.Student.UDFValues)
((IntegerAttribute)udfVal.TypedValueAttribute).Value = 400;
UDF fields can be of any type [Integer, String, Date etc] and while doing the typecast and assigning values you will have to do lots of checks using the different types of attributes provided by SIMS as shown below:
FieldTypeCode of UDFValue will provide with the Type of UDF and then you do following checks:
if (fieldTypeCode == UDFFieldType.STRING1_CODE ||fieldTypeCode == UDFFieldType.STRINGM_CODE) //StringAttribute
else if (fieldTypeCode == UDFFieldType.DATE_CODE) //DateAttribute
else if (fieldTypeCode == UDFFieldType.INTEGER_CODE) //IntegerAttribute
else if (fieldTypeCode == UDFFieldType.DOUBLE_CODE || fieldTypeCode == UDFFieldType.DOUBLE2_CODE) //DoubleAttribute
else if (fieldTypeCode == UDFFieldType.BOOLEAN_CODE) //BoolAttribute
else if (fieldTypeCode == UDFFieldType.LOOKUP1_CODE) //EntityAttribute
else if (fieldTypeCode == UDFFieldType.ASPECT_CODE) //StringAttribute