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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Writing script to pick up transactions within 14 days of last transaction

Trying to write script to capture the following:

see call claims that occurred within 14 days or less of last claim for a particular unit.

Thank you,

Venus

7 Replies
erichshiino
Partner - Master
Partner - Master

Hi, Venus

Could you provide us with some data samples, table or a small application with you data model.

I'd like to understand it a little better before answering your question.

Rgds,

Erich

Not applicable
Author

Hi Erich,

Here's the sample.

I want to set up a script to monitor this unit and see if it has a new transaction within 14 days of the last one on 4/6/11.

Transaction Date

Unit#

Problem

20100810

100364927

LIGHTS INOP. FOUND LOOSE CONNECTION.CONNECT. JD

20101013

100364927

PUMP LEAKING RR/MP

20101014

100364927

20101014

100364927

20101014

100364927

TRIPS BREAKER OZONE SHORTED RR/MP

20101022

100364927

SPEAKER IN OP RR PART LES

20110217

100364927

FAULTY STEREO RR

20110406

100364927

TOPSIDE:Moisture inb TOPSIDE



Thanks for the help.

Venus



erichshiino
Partner - Master
Partner - Master

Hi, Venus.

This is an app a build based on your table. I created another unit to test how it would work.

I solved the problem with script and some set analysis.

I hope it will work now for you. Tell me if there is any doubt.

Not applicable
Author

Erich,

It's close. Sorry, I was not specific enough.

Script shoud compare the last two different transaction dates for a specific unit and provide a list with all transactions with 14 days difference between the two dates.

IDProblemTransaction DateUnit#ntDatedaysFromLastmaxnDate
7FAULTY STEREO RR2011021710036492717/02/20114806/04/2011
8TOPSIDE:Moisture inb TOPSIDE2011040610036492706/04/2011006/04/2011
2/17/20114/6/2011
last transactioncurrent transaction


Thanks again,

Venus

erichshiino
Partner - Master
Partner - Master

Hi, Venus.

I hope I solved it now Smile

Not applicable
Author

Erich,

Thank you. Just one more question. Can this be done without the use of sequence numbers? From this set, the line in red is what should be captured.

Tag#Service Datedays between failuresUnit#Customer Number
4550279/25/20090ABC1234123
55971911/24/2010425ABC1234123
55976711/30/20106ABC1234123
5859252/11/201173ABC1234123


Thank you,

Venus

erichshiino
Partner - Master
Partner - Master

Venus,

the sequency field I build on the script. I doesn't exist on the database using order by and peek()

You could use a similar expression and adapt it for a background condition.

Tell me if you have any doubts on the script