Sort results on page load using global variables


#1

Hi All,

I want to create a page which will have a list of items sorted in order of which one has the highest value (global variable)

So user selects 10 items on a page, then when next page loads it will have the results ordered from most relevant (most matches on previous page to least matches).

i am not too fussed how the next page is presented, either by widget ordering or repeaters, but does anyone have any ideas on how to accomplish this?

Thanks in advance
Chris


#2

Hi @christofalee,
You’re dead on, I would use global variables with a repeater.

if each repeater has a unique property, you can simply pass those properties in order to the global variable that you will use on the next page.

Repeater Example (Page 1)
Column0
The First Article
The Second Article
The Third Article

Now each of these titles is unique so you can set your global variable to:
“The First Article, The Second Article, The Third Article”

The important thing is that each string of characters is unique

Repeater Example (Page 2)
Column0, Column1
The First Article, [leave blank]
The Second Article, [leave blank]
The Third Article, [leave blank]

Then on page #2 your repeater needs an “Item Loaded” event.

Update Rows
This set Column1 to “[[GlobalVariable.indexOf(‘Item.Column1’)]]”

This will assign numbers to each repeater row.

Now on Page #2 on your repeater add a “Loaded” event.

Add Sort
This Column1 as number asc

This will reorder the repeater based on the numbers.


#3

Hey,

Thanks for your help so far, i’m still getting a little bit stuck. I think the problem is for this action

Update Rows
This set Column1 to “[[GlobalVariable.indexOf(‘Item.Column1’)]]”

This is my global variables (added 2 just for sanity), these values are being set on page 1

image

This is page 2 with repeater selected (the value of Column1 is visible for the repeater for display purposes, but is blank due to “null value” so i can validate if my global variables are coming through). This is where i think i am a bit lost/confused. I need to figure out how do i link the variable to column.

I think i have found the correct steps, but just unsure of how to link it up etc.

Can you fill in the blanks for me please lol :slight_smile:

Obviously i need to figure out the above before i can get onto sorting, but i seem to be struggling with the sorting, as i can’t even sort with the static values i put in either.

Thanks again for your help so far @josh_db


#4

Hi @christofalee
So Axure did not respond as expected, but here is a working example.
save-repeater-order.rp (70.1 KB)

There were some odd quirks like requiring a repeater value in Column1 on Page 2 for this to work. That’s not the way this should be designed, but alas this is why it was challenging to accomplish.


#5

Thanks again @josh_db

I don’t have access to Axure 9 at this stage (currently on v8, but i’m working on it),

Are you able to screenshot the relevant info from the .rp file please?


#6

Page 1

save-repeater-order_page1

Page 2

save-repeater-order_page2