How does the function REPLACE work in a custom field?
How does the function REPLACE work in a custom field?
0
Comments

If you put REPLACE before a field for example REPLACE(Amount,0) then the CF will return a 0 in all cases where no Amount is calculated. It's a way of still calculating a value for a complex CF in cases where not all fields are present. For example you can have a formula:
Area*(REPLACE(Amount,1))*Replace(CConst1,1)*REPLACE(Height,1)/Dilution*Sampleweight
That way if you are missing any values, it will be replaced by 1 and the CF will continue with the remaining fields. Without REPLACE the CF would crash and not give a result.
It's essential to tick the Missing Peak option when creating any CFs where REPLACE is used.0 
I thought it will be useful for me, but I have already seen that not.
So now I have the following issue:
I have created a CF that calculates a value "Amount_TD_gastro": Peak/Real/Calculated, ((Peso_patron/Volumen_matraz_patron)*(RIQ/100)*100)/(20/100).
I have also created a CF that calculates a value "Resultado_gastro": Peak/Real/Calculated, 100Amount_TD_gastro.
I need to create now 2 custom fields:
1. a CF that gives value 0 when "Resultado_gastro" is under 0 and "Resultado_gastro" when "Resultado_gastro" is 0 or above 0
2. a CF that calculates the mean for the previous custom field0 
For the first CF, called Conditional_CF you could create a peak, real, calculated CF with the formula:
LT(Resultado_gastro,0)*0+GTE(Resultado_gastro,0)*Resultado_gastro.
Any value less than 0 is a minus figure though, is that typically the results you get? i.e. 0.087 or 2.899 etc. Also, in your formula for Amount_TD_gastro the (RIQ/100)*100 is really just RIQ*1, since 100/100 is always 1, you can leave it at just RIQ.
As for the mean, depends on how many samples and if you want an overall mean per component across multiple samples or a mean of all the components in the one sample. You could label your samples the same for example U1 and then create a peak, real CF with formula SAME.%..AVE(Conditional_CF).
If you want the mean of all the values in the chromatogram then create a Result, Real Calculated CF with formula: AVE(Conditional_CF)0 
Perfect!
Thank you very much
I really appreciate your tips0