Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
vebjornsvare
Contributor
Contributor

Field-condition in table

Hi, 

How can I solve this problem?

I have a table like this with a task and a number connected.

22-3

22-4

22-5

23-6

24-7

25-3

25-4

 

How can I sort out just the first of each task so that the table will look like this:

22-3

23-6

24-7

25-3

 

Is it possible to implement a condition in the field dimension, and not in the script?

This must work for a long list of numbers, not only this example. 

 

 

 

Labels (1)
2 Replies
Gysbert_Wassenaar

Perhaps like this:

Tasks:
LOAD
    Task,
    SubField(Task,'-',1) as TaskNumber, 
    SubField(Task,'-',2) as Number 
INLINE [
Task
22-3
22-4
22-5
23-6
24-7
25-3
25-4
];

 

Result:
LOAD
    Task
WHERE
    Index = 1
    ;
LOAD
    Task,
    If(TaskNumber=Previous(TaskNumber), Peek(Index)+1,1) as Index
RESIDENT
    Tasks
ORDER BY
    TaskNumber,
    Number
    ;

DROP TABLE Tasks;


talk is cheap, supply exceeds demand
vebjornsvare
Contributor
Contributor
Author

But it is possible to solve this without coding in the script, only use the user interface?