Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Getting the ID number from the last row saying: "Started"

Hey guys, I have a simple question:

SequenceStatusName
1StartedA
2StartedB
3Not StartedC
4Not StartedD

I want to create a field that says that the current position is "2" (last one started). I tried to use this:

IF(Status=PREVIOUS(Status),'',Sequence) as Current_Position.

The problem with that, is that also counts the headers, so, number "1" always come in this field, and I don't want that, i want simply to show "number 2".

How can I do that?

Thanks

1 Solution

Accepted Solutions
MVP
MVP

Re: Getting the ID number from the last row saying: "Started"

Hi

You could so this after loading the data in your post:

MaxValues:

LOAD Max(Sequence) As LastStart

     'Started' As Status

RESIDENT Data WHERE Status = 'Started';

To get that into a variable, use Peek()

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
3 Replies
MVP
MVP

Re: Getting the ID number from the last row saying: "Started"

Hi

You could so this after loading the data in your post:

MaxValues:

LOAD Max(Sequence) As LastStart

     'Started' As Status

RESIDENT Data WHERE Status = 'Started';

To get that into a variable, use Peek()

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

Re: Getting the ID number from the last row saying: "Started"

Thanks it did work well! I would like to get also the number of the last item in the table. how do I do that?

Re: Getting the ID number from the last row saying: "Started"

Something like this should do the trick:

LET vLastItem = PEEK('FieldName', NoOfRows('TableName')-1, 'TableName');

Community Browser