Flex Repeater instance parameter refresh issues

I'm having an issue with flex repeater instances not refreshing reliably.

Here's the situation:

Flex repeater instances are bound to a named query and have 3 params

I have a popup form to add/modify line items to the database

I have a button with a onClick refreshBinding script

When I add an entry in the database and click the refreshBinding button, my flex repeater shows the additional new instance.

However, when I modify an entry in the database and click the refreshBinding button, the flex repeater does not update the params of the existing instances.

If I then add an entry and click the refreshBinding button, the new instance is shown, but the previously updated data is still not reflected in the existing instances params.

If I reload the page containing the flex repeater at any time, any updates to the database are reflected upon reload.

Anyone have any ideas as to why this is going on?

Try editing the binding and selecting "ok" to manually refresh it in the designer. Maybe the source data isn't making it's way to your binding.

Another approach you may want to consider...

You can populate your flex repeater with instances using a binding and a script transform. Make a copy of your screen and try it off a copy. This may be an approach that works for you because it will update your instances when the data that populates your flex repeater changes or you can have it go off a dataset and refresh the binding on that to update all your parameters.

It's a little daunting to do this the first time but there's a trick that makes it way easier.

Select your "instances" property on your flex repeater and copy it. Paste into a text editor. You'll see the JSON required to build the instances. Now you can build this JSON structure in a script transform to populate the flex repeater and populate all the dynamic elements using variables. Sometimes that approach is easier to manage with flex repeaters.

Do you have caching turned on for your named query? That would introduce a delay before a refresh would pick up changes.

Opening the bindimg for editing and hitting OK, doing a "Save All", and refreshing the page when viewed as client all successfully update the instances and all their parameters.

It's just the refreshBinding that doesn't seem be going deeper than updating the number of instances, leaving the parameters of existing instancea untouched.

I've been through this so many times that I've just defaulted to building instance arrays like how @Steve_Laubach describes at the end of his post. Get rid of refreshBinding and have that same button instead rebuild your flex repeater's instances and write the result to its props.instances. The button's script would look vaguely like this (again, not knowing how you are setting your parameters):

# Set or retrieve/build your parameter vals 1-3 up here

results = system.db.runNamedQuery("YourQueryPath", {"param1": val1, "param2": val2, "param3": val3})

instanceData = []

for rowIndex in range(len(results)):
    instanceData.append({
        "param1": results.getValueAt(rowIndex, "param1column"),
        "param2": results.getValueAt(rowIndex, "param2column"),
        "param3": results.getValueAt(rowIndex, "param3column")
    })

self.getSibling("YourFlexRepeater").props.instances = instanceData

Does anyone have a self contained example view?