Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

one to many relation

Hi ,

I want to connect a Date field to my source table ,Where Date Table column will have one and my source table column will have many,Can anyone let me know how can i create a Association,

Thanks,

1 Solution

Accepted Solutions
MK9885
Master II
Master II

You'd just need a primary key to connect to your dates in source table.

Maybe DateID?

trim(date(YourDateFieldhere,'YYYYMMDD'))as [DateID],

You can use the above code in both your Date Field Table and Source Table.

Check your Date Format (YYYYMMDD) it might be different in your script.

View solution in original post

6 Replies
MK9885
Master II
Master II

You'd just need a primary key to connect to your dates in source table.

Maybe DateID?

trim(date(YourDateFieldhere,'YYYYMMDD'))as [DateID],

You can use the above code in both your Date Field Table and Source Table.

Check your Date Format (YYYYMMDD) it might be different in your script.

rupamjyotidas
Specialist
Specialist

You can use number part of date

Num(Date) as DateID

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi

To create association between fields (ono to one, one to many, many to one whatever.....) just alias both fields with the same name. Qlik automaticly will associate it based on name (that is how qlikveiw / qliksense works)

Also as other mentioned above make sure you provide the same format for both fields (it is best practice if you associate numbers with numbers, text with text, dates with dates etc)

As there are not datatypes in Qlik engine it might be sometimes confusing. Have a read here about it:

QIX - A Forgiving Engine

kind regards

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Not applicable
Author

Thanks All ,

It worked fine after formatting the dates in both tables,

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi

Please mark CORRECT answers so we can close topic and move on.

regards

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
shubham_singh
Partner - Creator II
Partner - Creator II

Create a DateFlag and load all the dates in same field, something like this

LOAD

*,

CreateDate as Date,

'Create' as DateFlag

Resident TableName;

Concatenate

LOAD

*,

ModifiedDate as Date,

'Modified' as DateFlag

Resident TableName;