peptoulcer Posted April 29, 2011 Posted April 29, 2011 I thought I was smart. I am using a virtual table and I wrote $$dummy[iD] and there were 3,000 records. Now if I run it and want only 100 records, the remaining 2,900 variables stay there and it breaks. I tried clearing them all but I can't figure. Please tell me I don't have to write a script to clear 2,900 different variables. Nope, I tried Case ( not IsEmpty ( FilterValues ( Get ( CalculationRepetitionNumber ) ; $$dummy ) ) ; Extend ( "" ) ) but Extend will only take a field. I'm done for.
peptoulcer Posted April 29, 2011 Author Posted April 29, 2011 What I mean is that I now have $$dummy[2] through $$dummy[3000] :blond:
comment Posted April 29, 2011 Posted April 29, 2011 Please tell me I don't have to write a script to clear 2,900 different variables. No, just close the file and open it again. "Repeating variables" are not repeating in any sense. The "repetition" is just a number appended to the name of the variable.
peptoulcer Posted April 29, 2011 Author Posted April 29, 2011 I won't want the user to close the file. It is served. The next record set they want to work on may only have 10 $$dummy records but the calculation in the virtual table reads $$dummy[iD] so it evaluates since it is unstored. When I go to the virtual table I omit all existing 5,000 records except the number of records needed for the current count but even if they do not show, they evaluate right? I like to clean up behind myself. I wonder how many variables a program can hold? What if I kept adding and global variables and didn't empty them. Would system run out of memory? I may need to change this and put this virtual table into a virtual file instead so I can close it. Approaches and ideas greatly appreciated. I mean that this virtual table is inside my regular program file.
comment Posted April 29, 2011 Posted April 29, 2011 (edited) I won't want the user to close the file. I didn't mean the user - I meant you. I thought you were asking how to get rid of variables wholesale, without clearing them individually. There is no other way, AFAIK. If you don't want to have unnecessary variables, you should not be creating them in the first place. Approaches and ideas greatly appreciated. It would help knowing what are you trying to accomplish. In general, I find it more convenient to store multiple values as a return-separated list in a single variable. --- BTW, clearing a few thousand "repeating" variables in a loop is also not such a big deal. Edited April 29, 2011 by comment
bruceR Posted April 29, 2011 Posted April 29, 2011 I thought I was smart. I am using a virtual table and I wrote $$dummy[iD] and there were 3,000 records. Now if I run it and want only 100 records, the remaining 2,900 variables stay there and it breaks. I tried clearing them all but I can't figure. Please tell me I don't have to write a script to clear 2,900 different variables. Nope, I tried Case ( not IsEmpty ( FilterValues ( Get ( CalculationRepetitionNumber ) ; $$dummy ) ) ; Extend ( "" ) ) but Extend will only take a field. I'm done for. Extend has nothing to do with variables. Agreed that an explanation of what you are trying to do would be helpful. A script to clear 2900 variables is fast and simple: Set variable [ $k; 10] //or whatever your start point is Loop Exit loop if $k > 3000 Set variable [ [$$dummy[$k]; "" ] Set variable [ $k; 1+ $k ] End Loop
peptoulcer Posted May 2, 2011 Author Posted May 2, 2011 Hi guys, This was for the writing to virtual table for charting which I had working perfectly. But I read a post which used the primary ID since it was number to grab a list of records in the so-called repetition of a global variable. I thought the post was by comment but now I can't find it. I am sure I had something wrong in my understanding of how and when to use it. I was using GetValue(bla;ID) originally but I realized that I could use the record number itself (in this found set) as the rep number and grab info instead of using List($$var;value) to add them to the existing variable list. It seemed like it would be faster and cooler. In other words I tried to turn the list sideways in a global variable but still keep the values separate. Then the calc in the virtual would be $$dummy[iD]. I will try the script Bruce thank you. I want to understand this anyway because I think I might use something similar in future. But for this process, I think I will just go back to using List and GetValue since I had it working perfectly. If it isn't broken don't fix it. Comment said, "I find it more convenient to store multiple values as a return-separated list in a single variable." That is what I get for trying things that I don't understand yet. :D
comment Posted May 2, 2011 Posted May 2, 2011 That is what I get for trying things that I don't understand yet. Well, it is a good way to get to understand them... Using the primary ID as the variable's repetition number makes good sense when a record needs to retrieve its associated value regardless of the record's order in the found set. Even then, a good alternative exists using only 2 variables: one as a list of values, and one as the index to the list - see: http://www.briandunning.com/cf/908
Recommended Posts
This topic is 5024 days old. Please don't post here. Open a new topic instead.
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