How can I enter a value, check it against repeater data, and display the result?

Hi all, apologies if this is a repeat. I have such a hard time trying to find a particular answer (and I have looked)!!

I want to build an input field that:
a) checks an inputted numerical amount against
b) a particular column within all rows within a Repeater, then shows
c) the highest numerical example, and
d) the lowest numerical example.

Think Google Flights recommending $145-200 for a flight to Dallas. It checks a database for the destination (Dallas), a low price (145) and high price (200).

I have the input fields and Repeater set up. But the next steps are all murky. I think I want to build a conditional statement, but I am not sure even how to start. My caveat is that I am WAY more visual designer than coding savant.

Yeah, the search engine in this forum is not too good.

While you don’t have to be a savant to do this in Axure, there’s not a way to accomplish this with just point & click or visual-only tools, You’ll need to do some programming–at least with real values and repeaters. If you’re just trying to get across a concept, you could fake some examples with dynamic panel states and very basic interactions. But repeaters are great for your needs here, and although they can be tricky to learn, and get the results you expect, this is a pretty good scenario to learn some basic repeater logic and programming.

There are also several approaches you could take to “search” a repeater and return certain values. For your objectives, I think the easiest approach is to have the repeater itself calculate the highest and lowest prices, and then just apply filters to constrain the items (rows.) However, I’m not exactly sure what you’re asking for here…

That sounds like the user can enter a price and check available flight prices. However, if it is one price value, how would that correlate to a range (highest and lowest)? Maybe it is a “maximum price” willing to be paid? Or is it a date? Or flight number?

This makes sense, but the input would be text (“Dallas”) and not numerical.

It usually helps (us “helpers”) if you can upload your .rp file so we can understand how you’ve set it up, offer solutions based on that, and repost with solutions. Without this, I’ll make some assumptions–that user can enter either a destination and see a price range, or enter a maximum price and see filghts less than that, or do both (e.g., flights to Dallas for less than $150)–and show you a demo of how I would achieve this.

repeater min max.rp (76.4 KB)

I made a repeater with some sample flights. There are 15 rows and 3 columns:

  • Destination
  • Flight (not really used functionally here)
  • Cost

I also created a few global variables to make things easier to track:

  • VarMinCost
  • VarMaxCost
  • VarFlightMatches

Repeaters are built with its Item Loaded event, which gets fired for each row in the dataset. Mine has 6 conditional cases:

  • Case 1, If true
    • (Will always fire every time)
    • Sets the text for the 3 column widgets.
  • Case 2, If [[Item.isFirst]] equals “true”
    • Only fires once, for the first item/row
    • Assumes the first row is the only row, so sets both VarMinCost and VarMaxCost to the Cost value for this row ( expressed as [[Item.Cost]] )
    • This also creates a “baseline” for high and low.
  • Case 3, If [[Item.Cost]] is less than VarMinCost
    • This means another row has a cheaper flight
    • VarMinCost is updated to this row’s Cost value.
  • Case 4, If [[Item.Cost]] is greater than VarMaxCost
    • VarMaxCost is updated to this more expensive flight
  • Case 5, If [[Item.isLast]] equals “true”
    • Only fires once, for the first item/row
    • Sets the value of VarFlightMatches to the number of rows.
    • By default, this will be every row in the repeater. But, when user searches for something, a filter is applied, limiting the rows (more on this later.)
  • Case 6, If (user has selected a specific destination and this is the last row)
    • The “Min” and “Max” flight prices are updated for the user to see.

To allow the user to search for a specific destination, and not have to deal with things getting mistyped, and airports not represented, etc. I created a Droplist widget with limited set of airports. This widget’s Selection Changed event handles if an airport is chosen or “cleared”, but the main functionality is to apply a filter to the repeater when an airport is chosen. It is important to realize here that whenever a filter is added or removed, the repeater’s Item Loaded event gets fired, essentially rebuilding the repeater–which means VarMinCost and VarMaxCost will get reset, and limited to only those rows “in” the filter (those which have not been “filtered out” according to the filter logic.)

  • Add Filter with this logic: [[Item.Destination == LVAR1]]
    • –where LVAR1 is a “local variable” pointing to the selected option of the droplist.
    • [[Item.Destination]] is the “Destination” column value for the current row,
    • The ‘==’ (double equal signs) is a common programming language convention meaning “is equal to” --as opposed to a single ‘=’ meaning “set equal to”.
    • The result of this filter logic is that only those rows with Destination matching the search term will be shown. (I think of this as “disabling all the other rows” --but they are not deleted; removing this filter would then show all the rows again.)
    • So, if you select “Dallas” in the droplist, then only the flights to Dallas are shown/enabled in the repeater, with the lowest (min) and highest (max) prices shown.

Similar code is applied to the “How Much?” input field—technically to its “submit” button–adding a filter for a “highest cost”, thus showing only those flights less than the price value a user has entered. Additionally, if the user has already selected a destination, the filter is added in addition to the destination filter. So, if you first select “Dallas” and then enter $150, the only flights shown are those to Dallas for less than or equal to $150.

Here is the Axure reference documentation for Filtering Repeaters and Conditional Logic