Skip to main content

I can't find a way to do what I want.

I got a certain number of features. I want to find the max(date) on attribute date for those features, but I want the max(date) to be in relation to a condition on a value from an another attribute status.

 

So I want the max(date) to be calculated and returned

first from feature where status = completed

if no features have a status=completed then returned max(date) from the other features

 

1 20230330 completed

2 20230329 completed

3 20230331 running

4 20230329 waiting

would returned max(date) from feature 1 : 20230330

 

1 20230330 waiting

2 20230329 running

3 20230331 running

4 20230331 waiting

would returned max(date) from feature 3 or 4 since no value set to completed :

20230331

 

 

Hi @newsafeuser​ 

 

Did you try to use the transformer StatisticCalculator?

 

Workspace_Calculator 

 

Thanks in Advance,

Danilo


Hi @newsafeuser​ 

 

Did you try to use the transformer StatisticCalculator?

 

Workspace_Calculator 

 

Thanks in Advance,

Danilo

Hi,

 

Thanks for the reply, in fact if was only that I would have done just what you propose.

My problem is really handling the whole situation with the conditionnal aspect of thing, of checking first possibility and doiing calculation on it and if not check for the other possible situation to do another calculation.

 

Thanks again


If you assign a weight to your status values, so e.g. Completed = 1, Anything Else =2 you can then sort by Status in Ascending order first, then by Date in descending order, then can use the sampler to return the first value which should return the max date from completed if it exists, but any other status if it doesn't

image


Thanks a lot adding weight attribute was perfect logic for what I needed and allow to simulate all conditions.


Reply