Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Combining two or three fields in a list box into one field

Hi,

I just have a small question, and I am sure its super easy to do but I can't figure this out for hours and looked at a lot of posts. I was wondering it it was possible to combine two or three fields in a list box? I am currently connected to a database and I have survey list box with fields like (GOOD, BAD, DO NOT WISH TO ANSWER, NO RESPONSE, BLANK) and I wanted to combine DO NOT WISH TO ANSWER, NO RESPONSE AND BLANK into one field called name such as NOT RATED. I just want some guidance or direction on where or how I should accomplish this? Sorry if this is a repeated question I have search for hours trying to find the answer on the forums. Any help is much appreciated

Thanks

Cliff

1 Solution

Accepted Solutions
giakoum
Partner - Master II
Partner - Master II

The way I describe above will give you the result you wish using QV.

Otherwise, use CASE in SQL statement to do it.

Select

(CASE WHEN survey='DO NOT WISH TO ANSWER' THEN 'Not rated'

           WHEN survey='NO RESPONSE' THEN 'Not rated'

           etc

           ELSE 'Rated' END) as survey

SQL Server syntax

View solution in original post

5 Replies
Not applicable
Author

Hi,

How is your data arranged? I'd add a calculated field to your load script if they are all on the same table.

Chris

http://oneqlikatatime.blogspot.co.uk/

giakoum
Partner - Master II
Partner - Master II

LOAD * INLINE [

    RATE, RATE_TYPE

    DO NOT WISH TO ANSWER, NOT RATED

    GOOD, RATED

    BAD, RATED

    NO RESPONSE, NOT RATED

    BLANK, NOT RATED

];

AND USE RATE TYPE IN A LIST BOX

Note that RATE must have the same field name as in your original data.

Not applicable
Author

Hey Chris,

I have loaded by data from an SQL datebase, I have a column in Table1 in SQL called survey, which has good, bad, do not wish to answer, no response and blank. In my script, I load this data information using

SQL SELECT survey

FROM Table1

GROUP BY survey

and then there is a list box which contains all those fields. I'd like add do not wish to answer, no response and blank into one field called Not rated

Cliff

giakoum
Partner - Master II
Partner - Master II

The way I describe above will give you the result you wish using QV.

Otherwise, use CASE in SQL statement to do it.

Select

(CASE WHEN survey='DO NOT WISH TO ANSWER' THEN 'Not rated'

           WHEN survey='NO RESPONSE' THEN 'Not rated'

           etc

           ELSE 'Rated' END) as survey

SQL Server syntax

Not applicable
Author

Thanks giakoum got it to work the way I wanted I used the CASE statement

much appreciated.

Cliff