I'm looking for a simple way to pull all of the values from a particular column based on the rows I've selected in a multiselect table and put them into an array that I can pass to my query.
For example, I have this table here:
I want to be able to pass the two Product IDs as an array to my query without having to manually build an array every time I select or deselect a row.
For example when I use selectedRowKeys it does exactly what I want except its the value is the Keys where the value I want is "Product ID".
{{(tblNSLineItemFulfillments.selectedRowKeys)}} gives me the keys in an array.
Welcome to the forum!
In a transformer do the following
return {{yourTableName.selectedRows}}.map(it => {
return { product_id: it.product_id, //where product_id is the underlying name of the column not the Label
}
})
product_id can be the name of the key you need in the query
Thanks so much this has got me really close. How do I make sure i'm only pulling the values, of the key value pair?
If you se see here its repeating the key "product_id" where all I want is the values in an array:
For example the payload should be {"product_ids":["1234567","2345678"]}
Create a transformer and name it yourTransformerNameAsNeeded and populate it with
const product_ids = [];
return product_ids.concat({{yourTableName.selectedRows}}.map(it =>(it.product_id)))
Next create a variable named product_ids and set the Default value to yourTransformerNameAsNeeded.value