Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF and FSIZE in SELECTs
Message
De
10/11/1998 16:36:56
 
 
À
10/11/1998 14:57:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00156319
Message ID:
00156406
Vues:
31
Bob ---

I neglected to offer an alternative in my first response...sorry...how about this:

=AFIELDS(aInFields,"In")
cField=IIF(ASCAN(aInFields,"MYFIELD")#0,"MYFIELD","SPACE(30)")
SELECT &cField AS outfield FROM in INTO CURSOR out

BTW: I hope your tables aren't *really* named "in" and "out"....could cause some very ugly looking and hard to read code :-)

>I want to create a cursor with known fields from one with unknown fields. Suppose cursor In does *not* have the field myField:
>
>When I try:
>SELECT IIF(FSIZE('MYFIELD','In')=0,'Default',In.myfield) AS outfield;
> FROM In INTO CURSOR Out
>
>I get "SQL field myfield not found"
>
>However, if I leave out the alias:
>SELECT IIF(FSIZE('MYFIELD','In')=0,'Default',myfield) AS outfield;
> FROM In INTO CURSOR Out
>
>...it works.
>
>I'm nervous about this. Is it robust to use the second technique?
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform