Repeater division https://2zfwnk.axshare.com/#c=2

I have set up a repeater with 3 columns each with 3 rows, Name, Monthly, Daily.

Now i want the figure in the the monthly column to be divided by the days in a month (not current month)
Onitemload i have set the text on the repeater daily column to [[(LVAR1 / 28).toFixed(2)]] LVAR1 is the monthly value.

Now within axure the repeater displays the correct value within the daily column although out of sink, the 1st row has no value but the 2nd and 3rd row have the correct values albeit for rows 1 and 2.

when previewed all rows are populated with 0.00

Is this a bug or am i doing something wrong?

I also want the daily column to update OnLostFocus of a text field that contains a value within it - (the number of days within a month) but cant get this to update the daily column either

Any help greatly appreciated

Thanks

SamREPEATERDIVISION.rp (57.5 KB)

https://2zfwnk.axshare.com/#c=2

@Kempes81,

Your AxShare link is broken… I get a “Page doesn’t exist” error.

Could you also post your .rp file? That will help forum users help you faster.

Based on your description, it looks like LVAR1 points to the text on the “monthly” widget in your repeater, which is the same widget you are trying to set/update. My guess is the text on that widget has not yet been set at the time you are trying to update it. Try using [[(Item.Monthly / 28).toFixed(2)]] instead of LVAR1, where “Monthly” would be the name of your column in the repeater spreadsheet table.

For the OnLostFocus event, it would again help greatly to see how you’ve set this up in your .rp file. In general it can be tricky trying to track and control items as they get and lose focus, because it can happen in some mysterious/confusing ways. Also, keep in mind if you do something like “set text” on a repeater widget from outside the repeater, then every instance of that widget—all rows in your repeater—will be updated to that same text. There are ways around this, and I recommend approaching it as “update row 2: change column 3” (or “update all rows” if that is your intent.)

REPEATERDIVISION.rp (57.5 KB)

Have attached my file! Will have a look at [[(Item.Monthly / 28).toFixed(2)]]

Thanks!

Aha… Thanks for posting the .rp file. Now I see that you want to update your Daily column as an average of the Monthly column data. Makes sense.

See this updated .rp file where I’ve copied your stuff to Page 1 and made a minor change to your OnItemLoad algorithm:
[[(Item.Monthly / LVAR1).toFixed(2)]]
…where LVAR1 is the text on the “Days in month” widget.
That’s it. Everything else seems to work fine, including the OnLostFocus event.

See also Page 2 where I added a droplist widget to select a month, then updated the (now hidden) “daysInMonth” number. Oh, and shifted the “update repeater” code from OnLostFocus to OnMove. Just an example of a different way to achieve this with a more natural user choice.

REPEATERDIVISION.rp (95.5 KB)

Wow excellent really great to learn new things, this will come in very useful for my project

Thanks a lot!

Sam