Dexie.js
Dexie.js copied to clipboard
where with multiple column and anyof()
I have table data as mentioned below. Id Name Type 1 ABC SCAN 2 BDC SCAN 3 ABC MANUAL 4 BDC EXTDEV 5 ABC EXTDEV
As per the above Tbl data want ABC data including all 3 types.
I have tried below function export const getInventoryScanProductByAccNameAndType = async ( accName ) => await db.InventoryScans .where(['AccountName', 'ProductEnterType']).anyOf(accName, ['SCAN', 'MANUAL', 'EXTDEVICE']).toArray();
Can anyone help me to get the data below?
Id Name Type 1 ABC SCAN 2 ABC MANUAL 3 ABC EXTDEV
Given your table has an index '[AccountName+ProductEnterType]':
await db
.InventoryScans
.where('[AccountName+ProductEnterType]')
.anyOf([accName, 'SCAN'], [accName, 'MANUAL'], [accName, 'EXTDEVICE'])
.toArray();
thanks a lot. Your answer is very helpful for me.
Thanks for the above query. This was very helpful to get the data I want.