Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
hammermill21
Contributor II

Combining Data From One Table

Hello everyone,

I have one table:

LOAD

[ID] AS [Record ID],

[CREATED_DATE] AS [CREATED_DATE],

[CREATED_BY] AS [CREATED_BY],

[equip] AS [Type Equipment],

[equiploc] AS [Location],

[firex_type] AS [firex_type],

[firex_size] AS [firex_size],

[bc_num] AS [Scanned BarCode Number],

[building] AS [Building],

[floor] AS [floor],

[my_scan] AS [Scanned Bar Code],

[completed_] AS [completed_],

[tech_] AS [tech_],

[retired_barcode] AS [retired_barcode],

[new_barcode_] AS [new_barcode_],

[comments] AS [comments],

[buidling] AS [Other Buidling]

But both [bc_num] AS [Scanned BarCode Number] & [my_scan] AS [Scanned Bar Code] can have the same number, no number or just one of them has the number. So what I want it to do is combine them so that it displays in my table just one number:


I tried combing them by adding:


bc_num] &'-'& [my_scan] AS [Barcode Number],


But that gives me data like this:

Capture.PNG


What I need is for it to show the number just once.


Any ideas?


Thanks!


1 Solution

Accepted Solutions
vishsaggi
Esteemed Contributor III

Re: Combining Data From One Table

Try this?

Subfield([bc_num] &'-'& [my_scan], '-',1) AS [Barcode Number],

4 Replies
YoussefBelloum
Esteemed Contributor

Re: Combining Data From One Table

Hi,

try this:

if(len(trim(bc_num))=0, my_scan, if(len(trim(my_scan))=0, bc_num)) as [Barcode Number],

vishsaggi
Esteemed Contributor III

Re: Combining Data From One Table

Try this?

Subfield([bc_num] &'-'& [my_scan], '-',1) AS [Barcode Number],

hammermill21
Contributor II

Re: Combining Data From One Table

This worked perfectly! So I needed to use Subfield. Thank you!

vishsaggi
Esteemed Contributor III

Re: Combining Data From One Table

Yes. No Problem.

Community Browser