Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Populate data thru query in list box
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00663425
Message ID:
00664050
Views:
18
You can concatenate or otherwise manipulate the fields in SQL the way you want, for example this will give you 2 columns (assuming all fields are of the same type - if not you also will need to do some data conversion):
lcSource = "SELECT alltrim(last_name)+ ' ' + first_name + ' ' + sub_title AS concatenated1, person_id ; 
FROM sometable ;
WHERE your_condition_here ;
ORDER BY person_id ;
INTO CURSOR cSource"
so the expression for concatenated1 can be basically anything. You should make sure that the result is formatted nicely.


>Nick Thank you very much it is working.
>
>Can you tell me how i can concatenate the first five fields and show them in one single column and the last remaining field in second column.
>
>In the properties window of list box i wrote this:
>
>columncount = 2
>columnwidth = 240,240
>
>this is the code i am using which you have sent.
>
>**************code starts here**********
>
>lcSource = "SELECT project_no,workpkg_no,sub_sec,sub_para,sub_seq,sub_title ;
>FROM sub ;
>WHERE sub.project_no = this.project_no.value ;
>AND sub.workpkg_no = this.workpkg_no.value ;
>AND DELETED() = .f. ;
>ORDER BY project_no, workpkg_no ;
>into cursor cSource"
>
>WITH thisform.list1
> .RowSourceType = 3 && SQL Statement
> .RowSource = lcSource
> .Requery()
> .refresh()
> .setfocus()
>ENDWITH
>
>**************END**********************
>
>Thank you.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform