Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
karan_kn
Creator II
Creator II

Create new fields combined two fields with condition

For the below table add a Newfield which is B_ID if present but the C_ID, if B_ID not present, add a symbol like a '-' to see the difference. Refer the screenshot for better understanding.

Capture.JPG

LOAD * INLINE [

    A_ID, B_ID, C_ID

    1, 123, 1111

    2, 234, 2222

    3, , 3333

    4, , 4444

    5, 345, 5555

];

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

Try like:

Load

     *,

     If(Len(trim(B_ID))>0, B_ID, '-'&C_ID) as New_ID

;

LOAD * INLINE [

    A_ID, B_ID, C_ID

    1, 123, 1111

    2, 234, 2222

    3, , 3333

    4, , 4444

    5, 345, 5555

];

View solution in original post

1 Reply
tresB
Champion III
Champion III

Try like:

Load

     *,

     If(Len(trim(B_ID))>0, B_ID, '-'&C_ID) as New_ID

;

LOAD * INLINE [

    A_ID, B_ID, C_ID

    1, 123, 1111

    2, 234, 2222

    3, , 3333

    4, , 4444

    5, 345, 5555

];