
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to get peek data with a condition?
Hello everyone!
I've tried to search if this was already solved on the forum but without luck.
I need to get the location from the last same 'vin' (vehicle identification number).
Right now I have the following: IF(vin = PEEK(vin),Peek(location)) AS peekLocation
But if vin <> peek(vin) then I don't know how to fetch the next most recent vin.
See the attached image to see the real data.
Thanks in advance!
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
May be this:
YourDB_Table:
Load
Your_DB_Fields
From Your_DB;
Your_Table:
Load
Your_Fields,
If ( vin = Previous(vin) , Previous(location), location) As Last_Location
Resident YourDB_Table
Order By
vin, YOUR_DATE_FIELD
Asc;
Drop Table YourDB_Table;
So, as @MarcoWedel said, you should be able to order resident table by vin and datetime field ascending (from older to newer values).
Regards,
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you have to order by vin during load.
Please post some data as well as your expected result.
Thanks
Marco


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
May be this:
YourDB_Table:
Load
Your_DB_Fields
From Your_DB;
Your_Table:
Load
Your_Fields,
If ( vin = Previous(vin) , Previous(location), location) As Last_Location
Resident YourDB_Table
Order By
vin, YOUR_DATE_FIELD
Asc;
Drop Table YourDB_Table;
So, as @MarcoWedel said, you should be able to order resident table by vin and datetime field ascending (from older to newer values).
Regards,
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for the help, it works!
Cheers 🙂
