Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
girish_talele
Creator
Creator

SQL SELECT with - Where condition from Resident Table

Dear Experts,

Below given condition will work in resident table but

Is there any way to map below requirement in SQL SELECT from SAP database.

//===============================================================

Emp:

Load * INLINE [

    Emp, Ind

    30000000, Yes

    30000001, Yes

];

//===============================================================

SAP_Data:

LOAD

PERNR AS Employee,

NACHN AS Surname;

SQL SELECT PERNR NACHN FROM PA0002 Where ApplyMap('Emp', PERNR,'No') = 'Yes';

//===============================================================

1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can try :

Emp:

Load * INLINE [

    Emp, Ind

    30000000, Yes

    30000001, Yes

];

SUPERTEST:

LOAD

  Concat(Emp, ',') as TEST

Resident Emp

Where Ind='Yes'

;

LET vTest = Peek('TEST', 0, 'SUPERTEST');

SAP_Data:

LOAD

PERNR AS Employee,

NACHN AS Surname;

SQL

  SELECT PERNR NACHN

  FROM PA0002

  WHERE  PERNR  in ($(vTest))

;

drop table SUPERTEST;

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

5 Replies
yduval75
Partner - Creator III
Partner - Creator III

ApplyMap is a Qlikview Function. It must operate ine the Qlikview instruction.

Moreover you have to specify Mapping Load in your Map instruction

Emp:

Mapping

Load * INLINE [

    Emp, Ind

    30000000, Yes

    30000001, Yes

];

SAP_Data:

LOAD

PERNR AS Employee,

NACHN AS Surname

Where ApplyMap('Emp', PERNR,'No') = 'Yes'

;

SQL SELECT

  PERNR NACHN

FROM PA0002;

anbu1984
Master III
Master III

You cannot use Qlikview function in Sql. Either you have to hardcode in Sql or you can use ApplyMap() on Preceding Load

LOAD

PERNR AS Employee,

NACHN AS Surname Where ApplyMap('Emp', PERNR,'No') = 'Yes';

SQL SELECT PERNR NACHN FROM PA0002 ;

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can try :

Emp:

Load * INLINE [

    Emp, Ind

    30000000, Yes

    30000001, Yes

];

SUPERTEST:

LOAD

  Concat(Emp, ',') as TEST

Resident Emp

Where Ind='Yes'

;

LET vTest = Peek('TEST', 0, 'SUPERTEST');

SAP_Data:

LOAD

PERNR AS Employee,

NACHN AS Surname;

SQL

  SELECT PERNR NACHN

  FROM PA0002

  WHERE  PERNR  in ($(vTest))

;

drop table SUPERTEST;

Help users find answers! Don't forget to mark a solution that worked for you!
girish_talele
Creator
Creator
Author

Dear Aurélien MARTINEZ,

Thanks, it works (provided the no. of values in concat are few).

Regards,

Girish.

sidjustice
Contributor II
Contributor II

Any idea what is the limit on the number of values in concat?