Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Concatenating a string for a grid column
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00620925
Message ID:
00621003
Views:
29
This message has been marked as a message which has helped to the initial question of the thread.
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?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform