Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create a Column for a Field

Good Day All

I Have a Problem, But when i Join it,

the output is not like what i want

EmpCodeTimeCodeTimeLogs
Sample1F118:00
Sample2F118:30
Sample1F127:00
Sample2F127:30

The Output must be like

EmpCodeTimeInTimeOut
Sample18:007:00
Sample28:307:30

TimeCode is F11=Timein and the F12=TimeOut

The output of my Application is

EmpCodeTimeInTimeOut
Sample18:00-
Sample28:30-
Sample1-7:00
Sample2-7:30

I tried to use all kind of Joins but no effect

Thank you.

18 Replies
Not applicable
Author

Hi,

Here the data is not proper.. for some of the records Time code=F12 is not there and i could see the time code is F32 for some records..

could you elaborate what you want exactly..

Not applicable
Author

Good day sir,

     because the partner of this is F11 and F12 , F21 adn F22 [] F31and F32 but i just to test it on f11 and F12.

Thank you very much for your response.

Not applicable
Author

Good Day Sir,

     Kindly see my QVD for reference.

Sokkorn
Master
Master

Hi,

User this script

[TimeLog]:

LOAD idcount,

     empcode,

     timecode,

     timelogs,

     Time,

     Date

FROM [TimeLog.qvd] (qvd);

//********* Use Pivot Table ******************

[Method1]:

LOAD

    empcode        AS [M1.EMP],

    timecode    AS [M1.Type],

    Date         AS [M1.TranDate],

    Time        AS [M1.Log]

Resident [TimeLog] Where Match(timecode,'F11','F12');

//********* Use ApplyMap **********************

[TimeIn]:

MAPPING LOAD

    empcode &'-'& Date,

    Time

Resident [TimeLog] Where timecode='F11';

[TimeOut]:

MAPPING LOAD

    empcode &'-'& Date,

    Time

Resident [TimeLog] Where timecode='F12';

[Method2]:

LOAD Distinct

    empcode        AS [M2.EMP],

    Date         AS [M2.TranDate],

    ApplyMap('TimeIn',empcode &'-'& Date,NULL())    AS [M2.TimeIn],

    ApplyMap('TimeOut',empcode &'-'& Date,NULL())    AS [M2.TimeOut]

Resident [TimeLog] Where Match(timecode,'F11','F12');

See sample attached file.

Regards,

Sokkorn

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

I guess you are only intresed in for a given employeecode Time in and Time out...

See attached...

Phani

Anonymous
Not applicable
Author

Hi ,

check out this

step 1:

Directory;

LOAD empcode,

     timecode,

     IF(timecode='F11','ti','to') as flag,

     timelogs

FROM

test123.xlsx

(ooxml, embedded labels, table is Sheet2);

step 2 :

create a chart staright table

add empcode  as dimension

write two set analysis

=sum({<flag={'to'}>}timelogs)         for time out

sum({<flag={'ti'}>}timelogs)            for time in

you will get what you want

Not applicable
Author

Yup but a Date too.

Not applicable
Author

Perhaps I misunderstand, but how do you associate a particular time-OUT with another time-IN for any given employee?  In your data, sometimes you have time-OUT's with no apparent associated time-IN, and vice-versa.  Maybe I am missing something, but is there some way you tie the time-OUT records to a specific time-IN record?

I put together an example where the date of the time-IN is used to associate with a time-OUT.  I've attached QVW, and code is below.

TimeLog:
Load
   *,
   empcode & Date(Date,'YYYYMMDD') As empkey;
LOAD
   idcount,
   empcode,
   timecode,
   timelogs,
   Time,
   Date
FROM
TimeLog.qvd (qvd);

LogData:
LOAD
   empcode,
   empcode & Date(Date,'YYYYMMDD') As empkey,
   timelogs As TimeIn
Resident TimeLog WHERE timecode='F11';

Left Join Load
   empcode & Date(Date,'YYYYMMDD') As empkey,
   timelogs As TimeOut
Resident TimeLog WHERE timecode='F12';

Drop Table TimeLog;

This assumes the time-OUT will always occur on the same day as the time-IN.  If that is not so, then you'll either need another field to help associate the two events, or you could construct a model that assumes the time-IN's and time-OUT's are sequential (i.e., OUT always follows IN).  But again, I see problems in the data with this.  You sometimes have multiple OUT's with no apparent corresponding IN record, etc.

Not applicable
Author

Hi,

Source :

EmpCode

TimeCode

TimeLogs

Sample1

F11

8:00

Sample2

F11

8:30

Sample1

F12

7:00

Sample2

F12

7:30

Script

Table:

LOAD EmpCode,

     //TimeCode,

     TimeLogs as Timein

    

FROM

(ooxml, embedded labels, table is Tab3)

Where TimeCode='F11';

inner join

LOAD EmpCode,

     //TimeCode,

     TimeLogs as Timeout

    

FROM

(ooxml, embedded labels, table is Tab3)

Where TimeCode='F12'; 

Result :

EmpCode

Timein

Timeout

Sample1

8:00

7:00

Sample2

8:30

7:30