Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Concatenating a string for a grid column
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00620925
Message ID:
00621055
Vues:
10
Hi Simon,

This clearly sounds like a bug to me too. I know, that you can not use such expressions in Property sheet, where you're limited to 255 chars, but why you have problems in the code?

Thanks.

I think, the problem also can be in the variable lenght of the final result. May be if Chris will padr the whole expression to fixed lenght, this problem goes away by itself? Just a SWAG.

>Hi Chris
>
>You better use Sergey's method because even if your string is less than 255 characters you can get unpredictable results when the string is over 200 characters. I am working on a demo to send to MS which shows this BUG.
>
>Simon White
>
>
>
>
>>I think that controlsource cannot be longer than 255 characters. Add a method to the form, put your code there and call it from grids controlsource. Something like
* mymethod
>>Return alltrim(v_custlist.cu_addr1) + iif(empty(v_custlist.cu_addr1), "", " ") +
>>alltrim(v_custlist.cu_addr2) + " " + alltrim(v_custlist.cu_addr3) + " " +
>>alltrim(v_custlist.cu_town) + " " + alltrim(v_custlist.cu_county) + " " + alltrim(v_custlist.cu_postcode)
>>
>>...
>>
>>.column2.controlsource = "Thisform.mymethod()"
>>
>>>Following on from this I am trying to concatenate an address for the grid - this is the code...
>>>
>>>
>>>.column2.controlsource = [alltrim(v_custlist.cu_addr1) + " " + alltrim(v_custlist.cu_addr2) + " " +
>>alltrim(v_custlist.cu_addr3) + " " + alltrim(v_custlist.cu_town) + " " +
>>alltrim(v_custlist.cu_county) + " " + alltrim(v_custlist.cu_postcode)]
>>>
>>>
>>>which works OK but I am trying to test for empty address fields to prevent the double space appearing so I tried this sort of thing...
>>>
>>>
>>>.column2.controlsource = [alltrim(v_custlist.cu_addr1) + iif(empty(v_custlist.cu_addr1), "", " ") +
>>alltrim(v_custlist.cu_addr2) + " " + alltrim(v_custlist.cu_addr3) + " " +
>>alltrim(v_custlist.cu_town) + " " + alltrim(v_custlist.cu_county) + " " + alltrim(v_custlist.cu_postcode)]
>>>
>>>
>>>which works OK but I as soon as try to add the second and third etc iif statements I get the error "Command contains unrecognised phrase/keyword"...
>>>
>>>Is there a limit to one iif statment per line? Is there a way around this?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform