Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Return only 1 record in a table

Hi

I have a table that contains employee number and employee name, in some cases the table has 2 records

Eg

Employee no          EmployeeName

20000005               JOE BLOGS

20000005                joe blogs

I need to return just 1 record

1 Solution

Accepted Solutions

Re: Return only 1 record in a table

May be try using FirstValue or LastValue function in the script:

LOAD EmpNO,

          FirstValue(EmpName) as EmpName

Resident YourTable

Group By EmpNo;

6 Replies

Re: Return only 1 record in a table

May be try using FirstValue or LastValue function in the script:

LOAD EmpNO,

          FirstValue(EmpName) as EmpName

Resident YourTable

Group By EmpNo;

Re: Return only 1 record in a table

Hi,

Then what do you want to do with 2 emplyoee Name

Try concat()

try like

Load EmployeeNo,

Concat(EmployeeName) as CombineEmployeeName

From TableName;

Kind Regards

Great dreamer's dreams never fulfilled, they are always transcended.

Re: Return only 1 record in a table

Try like this if you have more fields in table add remaining field in group by

Data:

load Empno

         Firstvalue(Empname) as Empname

Group by Empno;

load Empno,

         Capitalize(Trim(Empname)) as Empname

From Table;

thornofcrowns
Valued Contributor II

Re: Return only 1 record in a table

Which one of those two records is 'correct'?

Re: Return only 1 record in a table

As per you data sample , due to the case miss match its showing as two different records try to convert then to common format using Capitalize() or Upper () function will do that

LOAD [Employee no],

Capitalize([EmployeeName]) as EmployeeName,

//Upper(EmployeeName) as EmployeeName

Re: Return only 1 record in a table

Good to question to ask

Community Browser