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

Link table creation

Hello,

I want to know how to create link table using script.

Please find the attached file for more information.

Thanks

Samir

1 Solution

Accepted Solutions
Not applicable
Author

Hi Sravan,

I have not tested yet, busy with other stuff.

I will try it after 3 pm today and update you soon.

Thanks

Samir

View solution in original post

13 Replies
Not applicable
Author

Hi see this link

http://community.qlik.com/message/36977#36977

it might help you.

regards

sravan

Not applicable
Author

User:

Noconcatenate

Load autonumber(LoginId & Server) as LoginIDServer,

        LoginId,

        Server,

        FullName,

        Emailid

;

LinkTable:

Load Distinct LoginIDServer,

        LoginId,

        Server,

Resident User;

Drop tables LoginId, Server from User;

Project:

Noconcatenate

Load  autonumber(Server & Project_Path) as ServerProject_Path,

Project_Path,

Project_Title,

Project_Created_On,

Server

;

Join(LinkTable)

Load Distinct ServerProject_Path

Project_Path,

Server

Resident Project;

Drop Fields Project_Path,Server from Project

;

LoginDetails:

Noconcatenate

Load autonumber(LoginId & Server) as LoginIDServer,

        autonumber(Server & Project_Path) as ServerProject_Path,

LoginId,

Server,

Project_Path,

Access_On,

;

Join(LinkTable)

LoginIDServer,

ServerProject_Path,

LoginId,

Server

Resident LoginDetails

;

Drop tables LoginId,Server from LoginDetails;


This must solve your problem..Notice it is untested...

instead of join may be you have to use concatenate depending on the data!

Regards

Sravan

Not applicable
Author

Hello Sravan,

Heartiest thanks for quick response.

I tried this but still it is creating one synthetic key (LoginIDServer+ServerProject_Path) and as my data too big, getting failure.

I guessed why it is creating synthetic key: In LinkTable table, after first two join, there are 5 fields:

LoginIDServer,

ServerProject_Path,

LoginId,

Server,

Project_Path

As we go further to join the LoginIDServer, ServerProject_Path from LoginDetails table to LinkTable table, it creates synthetic key.

Can you please guide me how to remove this synthetic key?

Thanks

Samir

Not applicable
Author

Hello Samir,

QV links tables together using same fieldnames. This is a very powerful and convenient feature of QV but it may also result into funny and unexpected results (data-structures like snyc-tables) if you are not familar with it. So the first try would be to use the qualify - statement before loading the seond table. Or rename the according fields, if you do not want the links.

Second is to look where it is necessary to link tables via keys together. It can be very useful to link tables, best with only one corresponding keyfield in each table.

HtH for the moment

Roland

Not applicable
Author

Hi Samir,

I think what you need is one more combined Key...

User:

Noconcatenate

Load autonumber(LoginId & Server) as LoginIDServer,

        LoginId,

        Server,

        FullName,

        Emailid

;

LinkTable:

Load Distinct LoginIDServer,

        LoginId,

        Server,

Resident User;

Drop fields LoginId, Server from User;

Project:

Noconcatenate

Load  autonumber(Server & Project_Path) as ServerProject_Path,

Project_Path,

Project_Title,

Project_Created_On,

Server

;

Join(LinkTable)

Load Distinct ServerProject_Path

Project_Path,

Server

Resident Project;

Drop Fields Project_Path,Server from Project

;

LoginDetails:

Noconcatenate

Load autonumber(LoginId & Server & Project_Path) as LoginIDServerProjectPath,

        autonumber(LoginId & Server) as LoginIDServer,

        autonumber(Server & Project_Path) as ServerProject_Path,

LoginId,

Server,

Project_Path,

Access_On,

;

Join(LinkTable) distinct

LoginIDServerProjectPath,

LoginIDServer,

ServerProject_Path,

LoginId,

Server

Resident LoginDetails

;

Drop Fields LoginIDServer,ServerProject_Path,LoginId,Server from LoginDetails;



If It still does not help, add an example!

Regards

Sravan

Not applicable
Author

Hey samir,

Did u solve your Problem??

Test by debugging with less no of records..

Not applicable
Author

Hi Sravan,

I have not tested yet, busy with other stuff.

I will try it after 3 pm today and update you soon.

Thanks

Samir

Not applicable
Author

Hi Sravan,

Many-many thanks...

It worked for me.

Now,using this technique I am able to link n number of tables.

Once again, heartiest thanks Sravan.

Thanks

Samir

Not applicable
Author

Hi Samir,

you are welcome!

Regards

Sravan