Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combine 3 cursors into one
Message
De
30/11/1997 19:50:53
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
25/11/1997 12:05:35
Shane Gilbert
Oklahoma State Department of Education
Norman, Oklahoma, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00062187
Message ID:
00062974
Vues:
24
>combine the 3 cursors into one cursor used in the label report. I can't >figure out how to combine the 3 cursors into 1 cursor. Or should I go about >this some other way? > >Shane Gilbert You'd have to find a common denominator to their structures and then do an select union of them, resulting in one cursor, about this select code, name, address, phone from firstcursor; union (select code, nickname as name, ; str(houseno,3,0)+' '+trim(street) as address, " " as phone ; from secondcursor); union (select " " as code, ; trim(firstname)+' '+lastname as name, address, phone ; from thirdcursor); order by 2,3 into cursor finalcursor Here I have assumed you want to keep the structure of the first cursor, and the second and third have slightly different structures so you'd have to manipulate fields to get the same structure as in the first one. When making Unions, you have to make sure that the resulting fields in all the selects match; for strings the length doesn't matter much (length is taken from the first Select), but for numbers it does - it tends to report errors when their sizes differ. This comes from SQL's measuring the width by what it finds in the first record, and it probably doesn't find equally sized numbers in all of the Unioned tables or cursors. The workaround is to select 0000000.00+numeric_field - the resulting number has as many places as you give it zeros; do the same in all the selects and it'll work.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform