Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Peek Last record

Hi All,

In my DB there is audit trial table.  Once I filter in OrderNo it will shown mutiple row.

My need is once I filter OrderNo the row should shown 1 row which is with latest EditDate (row highlighted in pink color).

I'm tried to use last value for RecordId and peek function for EditDate but failed

OrderNoRecordIdDepartDateTimeEditDate
OUB359893323652310-10-2015 14:00:0010/13/2015 14:21
OUB359893323409010-10-2015 14:05:0010/12/2015 17:19
OUB359893323651013-10-2015 14:00:0010/13/2015 14:19

I attached together with qvw.

Please assist me.  Thank in advance.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

add a flag in your script to identify the max

Left Join (TEMP7)

load

  OrderNo,

1 as FlagMax,

  Date(max(EditDate)) as EditDate

Resident TEMP7

Group By OrderNo;


1.png

View solution in original post

7 Replies
Anonymous
Not applicable
Author

I have made some changes at script level,

just run it from your data source, you would be getting last ID at UI..

Anonymous
Not applicable
Author

in a normal table you cannnot use expressions, just define existing fields

if you use a straight table instead

you can define dimensions (OrderNo,RecordId) and expressions where you can define =aggr(max(DepartDateTime),OrderNo) and aggr(max(EditDate),OrderNo) and it works

by the way, last edit date is 10/13 and not your highlighted row

maxgro
MVP
MVP

add a flag in your script to identify the max

Left Join (TEMP7)

load

  OrderNo,

1 as FlagMax,

  Date(max(EditDate)) as EditDate

Resident TEMP7

Group By OrderNo;


1.png

Not applicable
Author

Here is a solution that works for me

MaxDate:

  Load

  MAX(date(UPDATE_DATE,'DD/MM/YYYY')) as maximum

  From ..DATA

  

  LET vMAX = PEEK('maximum', 0, 'MaxDate');

LATESTRECORD::

  LOAD

ORDER_INFO,

     UPDATE_DATE

    FROM

DATA

  WHERE DayName("UPDATE_DATE ")=DayName('$(vMAX)');

Kushal_Chawda

Create the straight table with Expression

=aggr(max(EditDate), OrderNo)

See the attached

Not applicable
Author

This only peek for date....in the column is date and time

Not applicable
Author

Hairul

Change

MAX(date(UPDATE_DATE,'DD/MM/YYYY')) as maximum

to

MAX(date(UPDATE_DATE,'DD/MM/YYYY hh:mm:ss')) as maximum

Regards

Declan