Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

doing a calculation inline

Hi, I want to know if there is a way to do a calculation and save it in the script. Its best if I illustrate it, in my script I have:

Date (Today()) - Data ([Date logged]) as [Days since logged]

However I need to use [Days since logged] as a field for an intervalmatch scheme and this requires me to trim the calculation. Sorry this seems confusing, so what in the end I really need is:

Incident:

Load

//"Date logged",

Date (Today()) - Data ([Date logged]) as [Days since logged] ,

Trim ([Days since logged]),

Intervalmatch ([Days since logged])

Inner Join

Load

[Incident ID],

If("Days since logged" = 22, '0- 1 Day',

If("Days since logged" = 23, '2 Days',

If("Days since logged" = 24, '3 Days',

If("Days since logged" = 25, '4 Days',

If("Days since logged" = 26, '5 Days',

If("Days since logged" > 27 , '5 + days',)))))) as TimeOpen

Resident Incident;

Store Incident Into data/incident.qvd;

Any ideas how I can do this? If anyone could correct my script that would be amazing!

Cheers

Ben

2 Replies
Not applicable

Looking at the script piece you posted I am not sure why you would need an intervalmatch. Intervalmatch is used to match a date/time with a period that is defined by a start and an end. Or a point between two points (see script below)


Points:
LOAD * INLINE [
Point, Value
1, 100
2, 200
3, 150
13, 250
15, 175
22, 800
];

Periods:
LOAD * INLINE [
Start, End, Type
0, 9, Small
10, 19, Middle
20, 29, Large];

Temp:
INTERVALMATCH (Point)
LOAD Start, End
RESIDENT Periods;

JOIN (Periods)
LOAD Start, End, Point
RESIDENT Temp;


You could probably just do the JOIN without an intervalmatch. But perhaps I misinterpret what you want to do ...

Not applicable

Hi Ben,

here a an example without IntervalMatch. Not shure if you need it realy. It depends on your data.

Good luck!