Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Selecting Fields Problem Expression.

Hello,

I have the following question,

I want to load all the numbers in a field that are equal to a key in a different field. But i cant seem to get my if statement to work.

=IF(PK_R_RELATIONGROUP = FK_MAINRELATIONGROUP ,DESCRIPTION) this is what im using so far. This doesnt seem to work at all.

When i munual insert a number like =IF(PK_R_RELATIONGROUP = 1417 ,DESCRIPTION) It works perfect, however i want it to compare all the rows in the FK_Mainrelationgroup table.

Regards Luuk

1 Solution

Accepted Solutions
Not applicable
Author

After a bit of tweeking i made it like this. Not sure if this is the right way to do it but it does work.

ODBC CONNECT TO [IQ live];

Test:

QUALIFY*;

LOAD DESCRIPTION,

PK_R_RELATIONGROUP,

DATECREATED,

DATECHANGED,

FK_MAINRELATIONGROUP,

CREATOR,

USERCHANGED,

FK_WORKFLOWSTATE,

EXTERNALKEY,

CODE;

SQL SELECT *

FROM RampRiq.dbo."R_RELATIONGROUP";

Henk:

QUALIFY*;

UNQUALIFY Test.FK_MAINRELATIONGROUP;

INNER JOIN(Test)

LOAD

FK_MAINRELATIONGROUP,

PK_R_RELATIONGROUP,

DESCRIPTION,

IF(isnull(FK_MAINRELATIONGROUP), PK_R_RELATIONGROUP) AS Test.FK_MAINRELATIONGROUP,

IF(isnull(FK_MAINRELATIONGROUP), DESCRIPTION) AS Test ;

SQL SELECT *

FROM RampRiq.dbo."R_RELATIONGROUP";



View solution in original post

3 Replies
Not applicable
Author

your first if statement didn't work because FK_MAINRELATIONGROUP contains different values

unlike the second one, you used a specific value so qlikview processed it successfully..

maybe you can edit your load/select statement and put a where clause and join the two tables.

Not applicable
Author

Thank you for your quick respond,

The only problem i have is that FK_MAINRELATIONGROUP redirects to the same table primary key.

The FK_MAINRELATIONGROUP gives a number to a record placing it in a group. The name of the group is a

record within the sametable where the PK_RELATIONGROUP = FK_MAINRELATIONGROUP only at this record FK_Mainrelationgroup = null.

Im now trying to get a list that will show me all groups and then drill downs to the different mainrelationgroups.

But so far im not getting anywhere

Regards Luuk

Not applicable
Author

After a bit of tweeking i made it like this. Not sure if this is the right way to do it but it does work.

ODBC CONNECT TO [IQ live];

Test:

QUALIFY*;

LOAD DESCRIPTION,

PK_R_RELATIONGROUP,

DATECREATED,

DATECHANGED,

FK_MAINRELATIONGROUP,

CREATOR,

USERCHANGED,

FK_WORKFLOWSTATE,

EXTERNALKEY,

CODE;

SQL SELECT *

FROM RampRiq.dbo."R_RELATIONGROUP";

Henk:

QUALIFY*;

UNQUALIFY Test.FK_MAINRELATIONGROUP;

INNER JOIN(Test)

LOAD

FK_MAINRELATIONGROUP,

PK_R_RELATIONGROUP,

DESCRIPTION,

IF(isnull(FK_MAINRELATIONGROUP), PK_R_RELATIONGROUP) AS Test.FK_MAINRELATIONGROUP,

IF(isnull(FK_MAINRELATIONGROUP), DESCRIPTION) AS Test ;

SQL SELECT *

FROM RampRiq.dbo."R_RELATIONGROUP";