Author Topic: Help please - set user variable  (Read 4218 times)

Tags:
  • Élite
  • Posts: 488
  • Karma: +6/-0
*
Help please - set user variable
« on: 18 May 2010, 07:56 »
Hi,

I have a trigger and I want to calculate and set a variable for each selection in the market.  I have left this running today but now realise I think this only sets the variable once for the whole market - not for each and every selection.

Please can anyone tell me how (or if) I can do this ?

Thanks
Alfaman

  • Élite
  • Posts: 488
  • Karma: +6/-0
*
Re: Help please - set user variable
« Reply #1 on: 18 May 2010, 12:05 »
So, perhaps,  for example, can I name a variable:

my_var_sel_id

and have it set with a different value 10 times for each of the 10 runners in a race ?

  • All members
  • Posts: 10
  • Karma: +0/-0
Re: Help please - set user variable
« Reply #2 on: 18 May 2010, 17:18 »
If you are setting the variable to something simple like the selections back price then you might want to simply use the s_{index}_back_price notation.  For example, if you want to refer to the back price of the first runner then simply put "s_1_back_price".

Otherwise (and there may be an easier way to do this), create a variable for each runner.  That is MyVar1 (and create the formula pertaining to all the s_1 vars).

What is the formula for the variable you are trying to set?

Camel

  • Élite
  • Posts: 215
  • Karma: +4/-0
*
Re: Help please - set user variable
« Reply #3 on: 20 May 2010, 21:30 »

So, perhaps,  for example, can I name a variable:

my_var_sel_id

and have it set with a different value 10 times for each of the 10 runners in a race ?


Yes, but you wil need complete trigger block with 13 triggers and a counter my_counter to do this.

1.) set user variabe my_counter to 1 if my_counter is not set
2.) set user variable my_var_sel_id to s_1_back_price if my_counter is 1
3.) set user variable my_var_sel_id to s_2_back_price if my_counter is 2
.....
11.) set user variable my_var_sel_id to s_10_back_price if my_counter is 10
12.) set user variable my_counter to my_counter+1
13.) set user variable my_counter to1 if my_counter is 11

Each time this block is executed, my_var_sel_id has a different back_price stored.

1st execution: back_price of selection 1
2nd execution: back_price of selection 2
3rd execution: back_price of selection 3
...
10th execution: back_price of selection 10
11th execution: back_price of selection 1
12th execution: back_price of selection 2

I hope this solves your question, but I have no idea how to can use this.

Martin


  • Élite
  • Posts: 488
  • Karma: +6/-0
*
Re: Help please - set user variable
« Reply #4 on: 20 May 2010, 21:44 »
Hi Martin, thanks for that it gives me an idea.

I really wanted to assign a value to each selection if that selection was present in a text file (in a list....).

I think I could do this with your suggestion.  I have found another way of acheiving what I wanted.  In the process I found I could link MFpro to a spreadsheet without having a sheet for each market and using your counter idea, step through every selection in column A and use a value from column B if the sel_name matched column A,  in a formula.

The problem was it would only step through at the refresh rate and even at 0.3 secs that was going to take 3 minutes to go through the whole day's selections (over 500) so I ditched that but it was an interesting experiment.

Alfaman