Query's Confirmation Message is receiving wrong i value from button trigger in a ListView

I am triggering this query from a button in a ListView.

My query is:

EXEC DeleteFileGlobal @file_id = {{qryFilesFiltered.data[i].file_id}}, @table={{location.value}}

Which runs correctly.

My Confirmation message is:

#### Are you sure you want to delete {{qryFilesFiltered.data[i].name}}

But i is always 0 here so it asks if I want to delete the wrong file.

I guess my workaround would be to fire a JS query that triggers the delete query with additonalScope.

1 Like

Hey @bradlymathews!

Thanks for surfacing this, it looks like this is a regression in versions >2.110. I've let the dev team know and will report back here when it's fixed!

That also sounds like a good workaround for now, thanks for sharing it :slightly_smiling_face:

Hi, any updates on this bug?
I'm facing the same kind of issue when trying to reference a value with i from a ListView. Can't seem to reference it correctly in the confirmation message of the query triggered with Submit. No matter what I try, i is always 0. Any tips, please? I'm stuck and can't find a workaround for my use case.
Thanks!!

Hey @user001! Still not fixed, but I bumped this internally. Will let you know once I hear back :crossed_fingers:

Any workaround I can use in the meantime?

Great question! Yes, actually :slight_smile:

For Brad (the original poster), his workaround would be to fire a JS query that triggers the delete query with additonalScope.

In my example, I'm using modals instead of buttons inside my list view.

In the modal, I put som text asking if the user is sure and some buttons to function as the Yes or No options.

If Yes, the button triggers the query and closes the modal. If No, the button just closes the modal.

See attached app JSON if you want to poke around with my setup! You can import this JSON file by clicking Create new (home page) > From JSON. Quick docs on exporting/importing apps here. Let me know if you have any questions!
query-20confirmation-20i-20bug.json