Populate datagrid with Picture from table based on model selection

What I’m trying to do:
I am building a quoting app for Ball bearings (basically a catalogue with pricing based on user selected models and qty.) I have a table that contains SKU models with 3 columns: model_sku/price/model_picture.
The SKUs are like this: EXST20AS-AS, EXST20AS-VK, EXFT20AS-AS, EXFT20AS-VK, so on and so forth…
While the SKU models code are increments of 5 like so EXST20, 25, 30, 35, 105 (shaft diameter)
the picture is the same for all models EXST irrespective of shaft diameter, so for each SKU model (first 4 letters) I have one unique picture to that model.

Currently I am manually attaching the same picture over and over for the same “model” irrespective of shaft diameter, how should I structure the app in such a way that I have only one unique picture per each unique model?

What I’ve tried and what’s not working:
I have no idea what to try, I need some guidance here as I have no idea how to approach this.
Thank you!

Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 

Clone link:
share a copy of your app

I don’t think I understand what you’re asking, because to me it looks like your app is already setup correctly. You have a picture in the data table and you’re displaying that picture correctly in the data grid.

So you have everything in place to have a unique picture per row, if that’s what you want.

Since the data grid part seems fine, I don’t know if you’re asking about uploading pictures, dynamically generating pictures (probably not, but maybe?), or something else entirely.

Can you clarify that parts of the app that you’re having trouble with? Which form, which controls, what you want to have happen, what is currently happening, that sort of thing.

Well, the picture in the table keeps repeating (same picture over and over) till the model SKU changes.
At that moment I have another picture corresponding to the next model SKU.
My point is that I should not have the same picture uploaded over and over again.
So to say I have 10 unique models then I would have only 10 unique pictures somewhere, and I would call the corresponding model picture when needed in the datagrid…
My point is not to over upload same data if not necessary.

PS. can you please check what is going on with PDF download, as its broken and I don’t remember to have voluntarily change anything, I know it worked.

Thanks!

if alert(CustomerDetails(item=self.item), 
             buttons=[('Quote', True),('Cancel', False)], 
             large=True):
      open_form('Form2', item=self.item)
      pdf = anvil.server.call('create_pdf', self.item)
      download(pdf)
      pass
@anvil.server.callable
def create_pdf(customer_details):  
  pdf = anvil.pdf.render_form('Form2', item=customer_details)
  return pdf

Do you mean “I should not have the same picture displayed over and over again”?

Because uploading means something entirely different: it’s the transfer of one or more files from the user to your App. See the FileLoader here:

You can change the picture that is in each row in the data table by uploading new ones. That will change the picture that gets displayed in the data table.