Newbies djrc Posted December 29, 2004 Newbies Posted December 29, 2004 I'd like to write a calculation that uses the field name (that the calculation is in) as part of the expression. For example, if a have the field "Count Code 30" and I'd like to have the "30" usable inside the calculation, can that be done? I tried using get(ActiveFieldName), but that doesn't seem to do anything (it seems to be blank no matter what I do). Here's what I tried: Case ( Cat1 = GetAsNumber(Right (Get ( ActiveFieldName ); 2)) ; 1 ; 0) + Case ( Cat2 = GetAsNumber(Right (Get ( ActiveFieldName ); 2)) ; 1 ; 0) + Case ( Cat3 = GetAsNumber(Right (Get ( ActiveFieldName ); 2)) ; 1 ; 0 ) Ideally, this would check each of the 3 fields (Cat1, Cat2, Cat3) for the code number pulled from the field name and tally the total (which should be a number between 0 and 3). I am just getting zeros, however (because get(ActiveFieldName) is returning nothing). Any ideas?
Oldsneekers Posted December 30, 2004 Posted December 30, 2004 I just posted a question about the same funtion above a few days ago. I am told, and it tests out, that the function (get active field name) will update only in certain settings (setfield command, refresh, ...) See the post "get(ActiveFieldName) won't work" and the added answers. Good luck.
Newbies djrc Posted December 30, 2004 Author Newbies Posted December 30, 2004 Thanks to both of you. I had seen that thread yesterday when I was searching through the forum. I was hoping that I since was doing something different than Oldsneakers (my calculation actually only needed to run when the field itself was created) there might be a solution. Moreover, I think I need a different method than get(ActiveFieldName), since I just want to access the name of the field itself, not whatever the user is currently clicking in. So, I guess I really need "get(FieldName)" or "get(this.FieldName)". In any case, it sounds like get(ActiveFieldName) doesn't work in calcuations (even if it is what I needed) and that there is no way to access reflective information about the field itself (from within the field). Oh well, I thought I had come up with an elegant way to reduce typing...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now