Stripping data from selectedSourceRows

Hello,
This might be quite a rudimentary question however, I have enabled multiple row select in my database, so that I can select the rows of data I want, and then insert these via a bulkinsert query to my postgres database.

However, the full array has a lots of data fields I don't want to insert to my database table.... so how can I go about stripping these fields?

So, in the screenshot below, as an example - I'd like to:

Keep these fields and insert to my db:

  • lang
  • title
  • Body
  • dateTimePub

Remove these from the array before inserting:

  • isDuplicate
  • date

etc......

Any help is appreciated.
thanks.

I managed to do this, here is the code:

{{tblNews.selectedRows = tblNews.selectedRows.map(({ dateTimePub, image, dateTime, isDuplicate, sentimintIndicator, sim, wgt, authors, ...rest}) => ({
    ...rest,
    added_by: current_user.fullName, 
    
}))}}

@Tess had answered a previous question of mine, which was along a similar path. So I used this, along with ChatGPT - and it works :slight_smile:

Finally I've solved a question on the forum..... shame it was my own one :slight_smile:

1 Like

Nice, @maillme ! Love that a combination of an existing forum topic and chatGPT got you over the hurdle! Even if you did share the solution on your own topic, it will live on to be searchable on the interwebs and help lots of others if they're stuck with something similar! :clap: Not to mention it earned you 10 ToolTips as the person who posted a Marked Solution :white_check_mark: :raised_hands:

Well done and thank you for sharing this back here!

1 Like