# Can a ENUM custom field be used in another custom calculation?

I have a question regarding the following custom fields.

I have 3 fields

C1 calculates the average RT of the main peak in my first 2 injections
C2 to make the following fields easier just displays the RT for the main peak in the last injection

The ENUM field I have created is as follows: ENUM(LT(C1, C2), LT(C2, C1)), which returns the lower of the 2 original fields.

Can this field then be used in another custom calculation?

• It depends on what you need to do with the results from your ENUM custom field and this ties into your selection that you picked for "Use As" when you crate the ENUM field, so its Position, Text, Value or Field. I cant advise whats the best until I know exactly what you are planning to return based on whether C1<C2 or C2<C1. Do you need then a further custom field based on the results of the ENUM?
• It depends on what you need to do with the results from your ENUM custom field and this ties into your selection that you picked for "Use As" when you crate the ENUM field, so its Position, Text, Value or Field. I cant advise whats the best until I know exactly what you are planning to return based on whether C1<C2 or C2<C1. Do you need then a further custom field based on the results of the ENUM?

Essentially I am calculating %difference but I have to use the formula ((highest RT - Lowest RT)/Lowest RT)*100. And because one of the RT used is an average, calculated from another custom field I cannot use the MIN/MAX functions.

I can set the ENUM field from my original post to display the lower of the 2 RT values but I can't seem to be able to use that value in another custom field to finish calculating the %difference.
• Thanks for that. There may be an easier way to do this. When you say "one of the RT used is an average" do you mean you are comparing the Average RT of Injections 1 and 2 versus the RT of the last injections. So basically whatever is highest from those two is your highest RT and whichever is lowest from those two is your lowest RT, that correct?
• yes that is correct, comparing the average of the first 2 injections to the last and determining the lowest is basically the part of the calculation I'm getting hung up on.
• Ok thanks. Ill print the answer to this later on when I can get access to test data. This can be done easily enough.
• Create a peak, real, calculated custom field, leave the default search order to Result Set First or use Result Set Only, whatever suits you. This is CF_3 and here is the formula:

GT(CF_1,CF_2)*((CF_1-CF_2))/CF_2+LT(CF_1,CF_2)*((CF_2-CF_1))/CF_1

This custom field will evaluate the values of CF_1 and CF_2. If CF_1 is greater than CF_2 it will calculate CF_1 - CF_2 and divide the answer by CF_2. And if CF_1 is less than CF_2, it will calculate CF_2 - CF_1 and divide the answer by CF_1.

I just tested this on some data and it worked perfect. Hope this helps.

• Great!

That has worked a treat. Thanks for your help.