Multiplication function syntax for repeater

Hello,

I have a repeater (aka main table), which values I move to another one (think 2 panels to move values between each other). The second one (aka shortlist) is positioned above the first, and by default hidden.

Upon clicking a button, I want to:
a) display the second repeater
b) move the main table down by number of rows multiplied by certain value (row height) - the latter can be set as variable or entered as a value in the function, doesn’t matter.

I’m able to extract the number of rows, I’m counting number of rows with certain value in one of the fields:
[[mainTable.itemCount where item.move == "1"]]

Where I fail, is the multiplication procedure.
[[mainTable.itemCount where item.move == "1"]] * [[rowHeight]]
and
[[mainTable.itemCount where item.move == "1"]] * 40 doesn’t work. I know I’m missing something obvious, but I can’t seem to make it work.

Thanks,
Radek

All expressions have to be inside [[ ]]. So multiplying two numbers would be done as [[5 * 6]] NOT [[5]] * [[6]]. Expressions that are bracketed separately are evaluated separately and anything not inside the brackets is treated as plain text. For example, our [[5]] * [[6]] is equal to the literal string 5*6.

That said, those expressions don’t look like they’re valid for anything in Axure. Where are you using them? I’m not aware of any where keyword that works anywhere (looks kind of like SQL syntax which I’m 99% sure does not work in Axure) and it’s not clear what the multiplication you want to do will achieve here.

That said, you’d want something like [[someOtherStuff * rowHeight]]. So, your actions would be along the lines of:

Show widget UpperRepeater
Move widget LowerRepeater by X: 0, Y: [[Repeater.itemCount * rowHeight]]

Where Repeater is a local variable set to the upper repeater.

[[Repeater.itemCount * rowHeight]] worked, I sorted it out right after posting here.
BUT
I want to count number of rows with field “move” containing value of “1”, and that’s where I’m failing.
[[mainTable.itemCount where item.move == "1"]] nicely returns number of rows, and moves the repeater by number of pixels equal to number of rows.
[[mainTable.itemCount where item.move == "1" * rowHeight]] or [[mainTable.itemCount where item.move == "1" * 40]] doesn’t work though. Tried various combination of brackets and whatnot yet without any luck.

So long story short I need a mechanism like this:

  • Count number of rows with field called “move” containing “1”,
  • Multiply that by 40 (or a variable),
  • Move a repeater by that result.

Just a guess but maybe try:

[[(mainTable.itemCount where item.move == "1") * rowHeight]]

Hi @RadekJ,

Are you trying to automatically position one repeater below another one? If so, then the simplest solution is to add a case to your first repeater in the OnItemLoad event. Add a condition to check if it’s the last repeater item (If value [[Item.isLast]] equals true), and then use a Move To action to move the second repeater to [[FirstRepeater.bottom]].

To answer your original question: Whenever I want to keep a total of the number of items that meet a certain condition, I use a label widget (or a local variable), and I tally up the total as the repeater items are loading. When the first repeater item loads, set the total to 0. Then, OnItemLoad, if the condition is met (If [[Item.move]] equals “1”), increment the total. Then, when the last item loads, you will have the total number of items that meet your condition, so you can set up a move action and move the second repeater to total * rowHeight.

Here is an example: moveCount.rp (62.3 KB)

Is this what you were trying to accomplish?

-skb

Not necessarily. I think I overcomplicated things a bit with item.move (i took it from another example mentioned below). Here’s the full mechanism:

  • Display main repeater (aka main table)
  • User can select rows to be moved to the second repeater (aka shortlist) ( i used
    Upon clicking a button:
  • main table is moved down to make space for shortlist
  • items are moved to shortlist
  • shortlist is displayed with corresponding rows.

For the moving items between repeaters, I used stuff from this thread: Repeater: "Move" Content from One Repeater to Another?

So at current moment I’m just taking number of items in the shortlist and placing the main table at Y coordinate calculated from row numbers vs row height. Works nicely both ways :slight_smile: