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

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;

1 Reply
CurtDaughtry
Partner - Contributor III
Partner - Contributor III

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......