Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storing set/series of number in a field
Message
 
 
To
17/05/2012 19:13:18
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01543783
Message ID:
01543792
Views:
41
>>Hi,
>>
>>I need to store a series of numbers into a field (e.g. 1, 34, 22, 33, 3333, 7 and so on) so that later in the program it can be determined if a certain number is present in this "array" of numbers. Originally I was creating an array (based on this series of numbers), converting the array into a string, storing the string in a memo field; then retrieving the string and converting it to array. Now I am thinking that maybe there is a more efficient way. What if I store this series of numbers as a string of this type:
>>"1,34,22,33,3333,7" (basically converting each number into a string and then concatenating them). How would I then find out if a certain number (e.g. 3) is in the list? Using AT() will not give me the right result since character "3" is in the string but not the number 3. Anybody can suggest a more efficient method of storing this series of number and comparing them?
>
>My first thought would be to create and use a child table, rather than using some sort of ersatz "array". That way you can just use SQL. You will thank yourself later, when it comes to creating custom reports etc.

This case of storing this array of numbers is done during a certain process in a temporary cursor and the values are not stored permanently in any table. So no report will ever be necessary.
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform