Get the Last Items

Hi,

i have a thing called Points under Points has 2 column sides which is True or False

each member need to enter points under each column until an admin hit a button CLOSED

when it’s CLOSED the system will compute the total amount of points under each columns

ex.
True = 700 Total Points
False = 1000 Total Points

then the system will determine which column has the higher points in this case False has the higher because it has 1000 Total Points.

Now since the system already determine the Higher Points it needs to deduct Points to make it both column even so the system will deduct False 300 Points to make it even with True which has 700 Points

now remember that each points is entered by different members so what i need to get is how can i get those member that entered last the 300 points and return their points.

ex. these members below are under False column that has 1000 total points and needed only 700 points
John = entered 100 Points
Sam = entered 90 Points
Jim = entered 110 Points
Total of 300 Points

i need to return their Points because it will not be included since the system needs only 700 Points and john, sam and jim entered last.

when member entered a points, the system will save their Acct ID, Current Event ID and True or False column.

up for this one

It looks like you need this to happen on server side, i.e. API workflows.

What could be useful is a recursive scheduled workflow to

search the list, sorted by date of entry
when list sum points - last item’s points > 700, remove the last item
when list sum points > 700, reschedule

It’d probably be more efficient to turn it upside down …

search the list, sorted by date of entry descending
when list sum points - first item’s points > 700, remove the first item
…etc.

1 Like

what if the true or false is a dynamic number? because it will depends on how many points they enter per user so 700 will be a dynamic number

you said here “when list sum points - first item’s points > 700, remove the first item

how can i remove the first item?

Either pass this as a parameter to the API Workflow, or store it in the database somewhere to be looked up by the API Workflow.

Depends, if you are storing the list of items and all of them count, do something like
Delete thing, search the list, sorted by date of entry descending, first item

If you have a list of things that count, do something like
Change thing, set list to list of things, remove item: search the list, sorted by date of entry descending, first item

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.