Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to append columns to table?

Hi,

I have two tables: Table A and table B.

Table A looks like this:

AlarmcodeCreation Date
12345
99882
55667
99999

Table B looks like t his:

AlarmcodeCall DateResponse Date
12345
99882
55667

Both the tables have the field Alarmcode in common.

Table B has Alarmcode (values) which are present in Table A.

I want the columns Call Date and Response Date to be added into Table A.

It is possible that Table A has Alarmcodes which are not present in Table B. In that case these rows will have an empty value at Call Date and Response Date.

This is the code:

This is the code:

[Meldingen]:

LOAD

  //AutoNumber(JOB_NR) as %Melding.ID,

  AutoNumber(JOB_CONTRACT_NR) as %Locatie.ID,

  AutoNumber(JOB_SAP_REF_NR) as %SAP.ID,

  JOB_NR as [Melding.Nummer],

  Date(Floor(JOB_DATE)) as [Melding.Datum gemeld],

  Time(Frac(JOB_DATE)) as [Melding.Tijd gemeld],

  TimeStamp(JOB_DATE, 'DD-MM-YYYY hh:mm:ss') as [Melding.Moment gemeld],

  JOB_DESC as [Melding.Omschrijving],

  IF( IsNull(JOB_STATUS_NR), 'Onbehandeld',

  IF( (JOB_STATUS_NR) = 'O3', 'Openstaand',

  IF( (JOB_STATUS_NR) = 'O5', 'Afgehandeld',

  IF( (OIB_WorkFlowStatus) = 'status0',

  'Afgehandeld mail', '<Onbekende status>')))) as [Melding.Status],

  ApplyMap('Map_Melding.Prioriteit', JOB_PRIORITY_NR) as [Melding.Prioriteit];

...

LEFT JOIN([Meldingen])

LOAD

  //AutoNumber(JOBCALL_JOB_NR) as %Melding.ID,

  JOBCALL_JOB_NR as [Melding.Nummer],

  Date(Floor(JOBCALL_CALL_DATE)) as [Melding.Datum verstuurd],

  Time(Frac(JOBCALL_CALL_DATE)) as [Melding.Tijd verstuurd],

  Timestamp(JOBCALL_CALL_DATE, 'DD-MM-YYYY hh:mm:ss') as [Melding.Moment verstuurd],

  Date(Floor(JOBCALL_REACTION_DATE)) as [Melding.Datum geaccepteerd],

  Time(Frac(JOBCALL_REACTION_DATE)) as [Melding.Tijd geaccepteerd],

  Timestamp(JOBCALL_REACTION_DATE, 'DD-MM-YYYY hh:mm:ss') as [Melding.Moment geaccepteerd];

...

How can I achieve this?

Message was edited by: Nazeem Soeltan Added code from script.

Message was edited by: Nazeem Soeltan I've added 2 QVS's. the one with the left join and the other without. The field JOB_NR in the first table, is the same as JOBCALL_JOB_NR in the second table.

Message was edited by: Nazeem Soeltan In the files, The look at the tab: MELDINGEN. The first table can be seen as table A and the second, table B

13 Replies
ThornOfCrowns
Specialist II
Specialist II

Take a look at the JOIN syntax.

Not applicable
Author

I did, Qlikview then appends some rows, which results that Alarmcode has duplicate rows.. That's the reason that I'm asking this question here.

Not applicable
Author

what join you used

avinashelite

Hi

Use LEFT JOIN .It will give u the values containing in A along with values which are common in table B, with other columns.

Please refer the attachment.

Eg

Table A:

Load Alarmcode,

     Date

Select...

Left join

Table B:

Load Alarmcode,

     Call

Select...

Anonymous
Not applicable
Author

Or how about using the ApplyMap() function ?

vikasmahajan

you can join tables with left outer join.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
PradeepReddy
Specialist II
Specialist II

Try to use left Join..

TableA:

Load *

From TableA;

Left Join(TableA)

Load *

From TableB.;

Not applicable
Author

I already tried LEFT JOIN.

THis is the result:

sample-tables.PNG.png

as you can see  there are many duplicates.

PradeepReddy
Specialist II
Specialist II

It seems to be there are multiple enties in the table for Melding.Number.

Try to identify the

1) Common Fields  b/w the both tables

2) Unique fields i.e primary keys in both tables.

After Identifying those, Try to use LEFT JOIN, it will work.

Regards,

Pradeep