Looping an array of records by rows and columns

Very new to Retool and learning lots simply by using AI and of course reading items raised in this discussion forum. I have got stumped in my quest to put an app together and would like some assistance from the community if possible.


I am wanting to loop each record and extract:
Name, v_1 & rk_1
Name, v_2 & rk_2
etc
Name, v_8 & rk_8
so as to form a bulk update for a PostGre database table. v_1 to rk_3 always contains an integer. However, the other cols may be blank in which case the cols don’t get selected for insertion.
I would appreciate any advice or links to posts that might help me.
Kind regards
Brian