Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
List elements of a field in an array
Message
 
 
À
20/04/2004 19:07:34
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00896552
Message ID:
00896721
Vues:
14
Steven,

>2. This is a table that holds a work schedule. Each record has week ending field, a job number field, and a scheduled resources field, example
>
>04/25/04 MES4410 SDE,CMA,EPY
>04/25/04 MES9999 CMN,SGE,MJS
>
>This tells what employees are working on which jobs on each week.

I'm with John on this one. Records with multiple values in in a single column is as bad as a table with repeating columns.

Can you change the structure of the table?

Your data will be much easier to work with if it was structured like:

04/25/04 MES4410 SDE
04/25/04 MES4410 CMA
04/25/04 MES4410 EPY
04/25/04 MES9999 CMN
04/25/04 MES9999 SGE
04/25/04 MES9999 MJS

If you can change the structure permanently then you should at least convert the data temporarily, and that would be easier and faster with a scan loop than a SQL statement, using alines() like Sergey posted to split the multivalued field apart and insert each row of the array into the temp table.
scan
   n = alines( laPeople, field, ',' )
   for i = 1 to n
      insert into temp values ( table.date, table.jobid, laPeople[i] )
   endfor
endscan
sorry I didn't have the tablename and field names available while writing that code fragment)

>To fill this second table out my manager pulls up a form with this table in it as a grid. The week ending and job number fields are filled out from another source. He has to assign employees to each record. A list needs to show up on the form also with all the available resources(easy part) and as he assigns employees to each record the avaliable list should decrease by the assigned employees(hard part since I have to compare a multi list string(SDE,EPY,CMA) to several single record fields). If I get assigned to a job in the grid my name(user id ) should not be listed to be used again until a week is access that I am not scheduled in.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform