Author Topic: sorting order & matching  (Read 4977 times)

Tags:
  • All members
  • Posts: 35
  • Karma: +0/-0
  • Gender: Male
sorting order & matching
« on: 21 Oct 2019, 12:09 »
Hi,

Can you please help with conditions to match the correct selection from the new defined sorted order.

If i define the sorting order by back_price * imported_1 for all selections in market.
I simply want to select the middle value(s).
I have a remember trigger to calculate the median selection/s (ie. odd amount of runner_number's gives 1 remembered selection & even runner_number races gives 2 remembered selections, but i cannot get the condition right - i dont know how to say if sel no.X in the list =X.

The condition i am stuck with is how to choose the 5th or 6th or 7th etc selection in the new defined order.

Trigger expression i am trying to implement looks something like this;
Selection trigger expression "matching_number" _((runner_number+1)/2) is equal to (runner_number+1)/2.
"matching_number" "match_index" or "match_selection"what is the correct way of writing this please?

Hope this sort of understandable.

Many thanks Kristian

  • All members
  • Posts: 35
  • Karma: +0/-0
  • Gender: Male
Re: sorting order & matching
« Reply #1 on: 21 Oct 2019, 12:27 »
will this work/?

match_((runner_number+1)/2) is equal to (runner_number+1)/2

  • Moderator
  • Posts: 3353
  • Karma: +278/-0
*
Re: sorting order & matching
« Reply #2 on: 21 Oct 2019, 16:59 »
Hi
Could be several ways to do this. Here I try the % modulus function to determine odd / even in the expression and it works ok.


Code: [Select]
selections trigger expression match_index is between INTEGER(matching_number /2) and IF(matching_number % 2 = 0, matching_number /2, INTEGER(matching_number /2) +1)
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 35
  • Karma: +0/-0
  • Gender: Male
Re: sorting order & matching
« Reply #3 on: 22 Oct 2019, 14:23 »
Hi Mark,

That's fantastic, thank you so much for your time.  Works a treat.

Lets hope its a winning bot......