Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ICASE cutting String
Message
De
12/10/2021 09:22:02
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
 
 
À
12/10/2021 08:43:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01682487
Message ID:
01682492
Vues:
40
>Hello comunity,
>
>I have VFP Cursor named mybolist with character field payment.
>Then i need to select this cursor into a new cursor to create condition on payment Field.
>
>
>select payment from mybolist
>The Result is PAYPAL
>
>When i write this new cursor:
>select  Icase(payment='MB', 'MB', payment='CC', 'VISA', payment='PAYPAL','PAYPAL') as 'Payment'  into cursor Mycrs Readwrite
>The result is PA  ??
>
>
>To solve this problem i rewrite like this:
>
>select  Icase(payment='MB', 'MB    ', payment='CC', 'VISA  ', payment='PAYPAL', 'PAYPAL') as 'Payment'  into cursor Mycrs Readwrite
>The result inow is  PAYPAL
>
>
>
>
>
>I deduced that the result must have the length of the string with more characters, why !?
>
>Many thanks,
>Luis Santos

As Martina wrote, this is a "feature". My preferred workaround is to use Cast:
select  cast(Icase(payment='MB', 'MB', payment='CC', 'VISA', payment='PAYPAL','PAYPAL') as c(6)) as 'Payment'  into cursor Mycrs Readwrite
Hello Tore,

Many thanks for your reply and also the trick using CAST() :)

Best regards,
Luis Santos
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform