Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storing set/series of number in a field
Message
From
17/05/2012 19:13:18
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01543783
Message ID:
01543787
Views:
43
>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.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform