Clearall except 1 variable

Hi, is there a chance to clear all variables with CLEARALL except one variable? This variable is a record. I tried to mark the record with MARK(TRUE)before clearing and get the record with MARKEDONLY(TRUE) after clearing, but it doesn’t work. bye Andre

I often create a function called “InitVars” that clears each variable except the ones I need to keep. While this means you still have to explicitly clear each variables, it makes the main logic code smaller and easier to read. Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117

Morning! Sometime it is very helpful to sleep on it. I get it! All I have to do is: - put the variable in the Currform.Caption - clear all variables - evaluate(MyVariable,Currform.Caption) - clear Currform.Caption Thats it! So easy! William: Thanks for your hint. bye Andre

Hi Andre, Wait a second, I’ve just tried your code and failed. You said that the only variable you’d like to keep uncleared is a Record type variable, so the following code should work: MyRecord.FIND(’-’); CurrForm.CAPTION := FORMAT(MyRecord); CLEARALL; MyOk := EVALUATE(MyRecord,CurrForm.CAPTION); MESSAGE(’%1 - MyOk’,FORMAT(MyOk)); MESSAGE(’%1 - MyRecord’,FORMAT(MyRecord)); MyOk gives me “No”. Did I miss something ? DMC

Dear Dmitry, sorry for late answer, but a had a short break last week.

quote:


Originally posted by Dmitry Chadaev: … MyRecord.FIND(’-’); CurrForm.CAPTION := FORMAT(MyRecord); CLEARALL; MyOk := EVALUATE(MyRecord,CurrForm.CAPTION); MESSAGE(’%1 - MyOk’,FORMAT(MyOk)); MESSAGE(’%1 - MyRecord’,FORMAT(MyRecord)); MyOk gives me “No”. Did I miss something ? …


There is a little error in your code: MyOk := EVALUATE(MyRecord,CurrForm.CAPTION); try this: EVALUATE(MyOk,CurrForm.CAPTION); or EVALUATE(MyRecord,CurrForm.CAPTION) => without

quote:


MyOk :=


This should work. bye Andre Edited by - andre ddb on 2002 Jun 24 11:43:53

Hi Andre, Your solution is fine, but it is not suitable for you original question:

quote:


is there a chance to clear all variables with CLEARALL except one variable? This variable is a record .


First of all you may use the CLEARALL function without any problems in that case, because:

quote:


CLEARALL Use this function to clear all internal variables (except REC variables),


And the second point is that the length of a caption seems like can’t be more then 468 symbols (according to my experiments), so you can’t store there long variables. But, still that is a cute solution for storeing other variables ! Thank you ! DMC

Hi Dmitry, maybe there was a missunderstanding. 1.My variable is a record-variable (globals), not the (internal) rec. And all globals will cleared after clearall. I my first posting I forgot the following: My form is independent. There is no rec. 2.I don’t fill the whole record in the caption. I take the primary key (in my case a code(20)). That’s it. After evaluate I make a setrange, then find(’-’) - and I have my record. It works. Believe me ! bye Andre