Replace Function in Empower 2

Discussions about chromatography data systems, LIMS, controllers, computer issues and related topics.

13 posts Page 1 of 1
The Empower help file uses the following example,
LTE(REPLACE(Amount,0), CConst1)*-60002+GT(REPLACE(Amount,0), CConst1)*Amount

Supposedly, this equation is stating that if Amount is less than or equal to CConst1, then the Amount field will be replaced with “Not Detectedâ€
Figured it out! Will post my resolution soon.
[quote="A_Chemist"]The Empower help file uses the following example,
LTE(REPLACE(Amount,0), CConst1)*-60002+GT(REPLACE(Amount,0), CConst1)*Amount

Supposedly, this equation is stating that if Amount is less than or equal to CConst1, then the Amount field will be replaced with “Not Detectedâ€
A cool feature that will make your life easier is the use as field enumerator. This lets you return any text depending on the logic and can also return a custom field. So you could easily setup an enumerator that will the result or "insert any text here".

For example.

Enunmertor equation = ENUM(EQ(GT(Custom1, 100),1)

0 = Custom1 fc()
1 = Custom1 is less than 100

So depending on the condition you can return any text you want to enter into the table. I just wrote "custom1 is less than 100


Try it
EmpowerGuru,
Enunmertor equation = ENUM(EQ(GT(Custom1, 100),1)

0 = Custom1 fc()
1 = Custom1 is less than 100

I tried this equation but it did not work. I am having trouble getting the enumerator or a boolean to report the custom field value. Empower help says to get it to report the custom field value type in: Custom Field (fc). I guess I do not understand what it is trying to explain. My custom field is named ug_per_can. I have tried ug_per_can (fc) to (ug_per_can) and everything in between to get it to report but nothing seems to work. It only reports what I typed in and not the actual numerical value in the custom field.

Help would be appreciated.
Thanks
0 = custom1 (fc)

sorry, the fc needs to be within the parenthesis


Did you set the drop down for 'use as' to field?
I got it working. Thanks for the initial direction, it was a huge help.
This is a good post as few know about the (fc) functionality in Empower custom fields and I have seen much confusion when folk try to get it to work.

Just a little clarification on the REPLACE function:
in the example given first - REPLACE(Amount,0) , Empower will only replace the Amount field with 0 if the value in Amount is invalid. In this way, the Amount field can still be used in the Bolean comparison.
Empower
MVC - Medicon Valley Consult
www.mvc-consult.com
Apologies for bumping a 9 year old thread, but it addresses a fn I'm a little confused about.

What I want: Purity factors in the component table to default to 100 if no value is entered.

What I have: Purity, a peak, real (0.0) CF with no default whose formula is REPLACE([Purity (Component)],100)

What it does: replaces even entered component purity values with 100 on review of result sets :oops:

Any suggestion?
Also not working:
LTE(REPLACE([Purity (Component)],0)*100)+GT(REPLACE([Purity (Component)],0)*([Purity (Component)])

My thought is that if Purity for a component is 0 or blank, it should be replaced with 100, and if it's >0, it is replaced with itself, but I'm either sort an argument or have too many braces or parentheses when I try to enter the above.
Thanks,
DR
Image
actually I'm not into CF programming at all, but from EmpowerGuru's post something like this maybe?

If I understand it correctly, with the ENUM(EQ())you simulate the "if-then-else" clause.

So it may go something like this

Enunmertor equation = ENUM(EQ(GT([Purity (Component)], 0),1)
0 = 100
1 = [Purity (Component)]

(If Purity(Comp) > 0, than GT() returns (1), so it should return the value of the enum entry at "1" otherwise returns the value on Enum=0

In your expression, shouldn't it be like this (your missing argument):

(LTE(REPLACE([Purity (Component)],0),0) *100)+GT(REPLACE([Purity (Component)],0)*([Purity (Component)])

What I don't know if the REPLACE is needed in the GT clause? Depending how "NULL" values are treated by Empower in such a case. Maybe it can be omitted,
or needs to be added in the ENUM statement above...
Thanks, I'll play with that a bit, but I suspect I may be in "no man's land" because I'm trying to ensure that a Purity (component) doesn't zero sample calculations as a result of failure of an analyst to enter a value and I don't think there's a way to set a default.
As far as my proposed formula, I think that it is too circular to work. Maybe making more CFs is the way to go - one to evaluate and replace the entry (or lack thereof) for Purity (component) and then just do a straight replace of Purity (component) for that CF's value.
(I've already proven I can replace an entry with a constant).
Thanks,
DR
Image
Empower 3 defaults any missing entries in Purity to 100 anyway, so it multiplies any value obtained by 1 (ie 100/100) if blank. Thats FR2 anyway, which is the version I use.

I dont have it in front of me but do you have "Missing Peak" ticked on your peak, real CF REPLACE([Purity(Component)]),100)? REPLACE needs Missing Peak to populate 100 in the event of no entry. Plus your CF will only really return a value of 100 for missing component entries which isn't used for any further equation. It isnt "linked" to the inbuilt Amount field so is useless for your needs.

Making template sample sets with these values already populated, then double checked by an experienced Empower user, may reduce these errors.

Edit- just saw you are using Empower 2 not 3. In this case, make a Component Real CF called Purity and have the default at 1. I presume its 1 you mean and not 100. Otherwise Empower will multiply Amount by 100 which isnt what you want? Purity/100 is typically entered as not 99.8 but 0.998.

Then a second peak, real CF called Final_Amount should complete it. Make sure Missing peak is ticked and the formula is Amount*Purity or if you dont want the analyst to convert Purity to a percent, the formula becomes Amount*(Purity/100). For any values which arent entered the default is 100 and the Final_Amount becomes Amount*(100/100) or Amount*1. For any other entered purity values Empower 2 adjusts the Amount for purity. Example Amount*(98.7/100).
I am using Empower 3, using 100 as default in a lab where everyone enters %.

So, I ended up having to actually reinstall it on my client where I was fiddling with this. I got it to a point where I could not process or even calculate stuff in review for runs that had previously been processed successfully!

I'm pretty sure you are just not supposed to over-complicate component fields like this.

At this point, I've got a call into Waters to try to find out why not having a blanket RT Ref and/or peak labels are critical to getting unknowns to calculate.
Thanks,
DR
Image
13 posts Page 1 of 1

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 1117 on Mon Jan 31, 2022 2:50 pm

Users browsing this forum: No registered users and 1 guest

Latest Blog Posts from Separation Science

Separation Science offers free learning from the experts covering methods, applications, webinars, eSeminars, videos, tutorials for users of liquid chromatography, gas chromatography, mass spectrometry, sample preparation and related analytical techniques.

Subscribe to our eNewsletter with daily, weekly or monthly updates: Food & Beverage, Environmental, (Bio)Pharmaceutical, Bioclinical, Liquid Chromatography, Gas Chromatography and Mass Spectrometry.

Liquid Chromatography

Gas Chromatography

Mass Spectrometry