Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Creating Age Field from Two Different Tables

Hi all!

I am trying to figure out how to create an age field in the load script based on how old participants where when they registered for an event. I have two tables, event and participant. I need to use the Begin_Date in the event table and the DOB in the participant table to calculate age, but I'm struggling on how to pull those two fields out to use them.

I've tried mapping but haven't had success yet. I get an error message that 'Generic tables must contain at least 3 fields'. I've tried taking off the brackets [ ] but that didn't work.


This is what I have so far, but if anyone knows a simpler or better way to do it, that would be great!


[BeginDateMap]:

mapping Load

[BEGIN_DATE]

resident event;

[AgeMap]:

mapping load

DOB,

age(ApplyMap('BeginDateMap',Begin_Date,0),[DOB]) as PartAge

resident participant;

Tags (3)
1 Reply
curtchamps
New Contributor

Re: Creating Age Field from Two Different Tables

A mapping table must have two (and only 2) fields in order to work.

example:

mapTest:

mapping load

     lookup_field,

     return_field

resident some_table;

load *,

applymap('mapTest', lookup, null()) as new_mapped_field......