I have a little problem, I have a new Array with id’s that I’ll need to filter. But I don’t know how I can do this.
relProgGruposFs.find()
relProgGruposFs.group_id = gruposIdExistentes.join("||")
relProgGruposFs.search()
This code works perfect, but my problem appears when I want to filter for the grupo_id’s doesn’t are this Array, how i can do this?
relProgGruposFs.find()
relProgGruposFs.group_id = "!=" + gruposIdExistentes.join("||")
relProgGruposFs.search()
relProgGruposFs.find()
relProgGruposFs.group_id = gruposIdExistentes.join("||!=")
relProgGruposFs.search()
This code doesn’t works, I know it, but is an example for you can know my problem, this work can I do in a find()? or must I search another method?
Thanks in advance!!!
Hi pentmasi
Maybe it isn’t the best way to do it, but have you tried with foundset.invertRecords()?
relProgGruposFs.find()
relProgGruposFs.group_id = gruposIdExistentes.join("||")
relProgGruposFs.search()
relProgGruposFs.invertRecords();
Best regards. Roberto Blasco.
Well, I know you can assign the array directly to the dataprovider when you want to perform an IN query
foundset.dataprovider = array
Unfortunately I’m not so confident the inverse would work, but you could try nonetheless
foundset.dataprovider = '!=' + array
```If that ends up not working you can always fall back to foundset filters
foundset.addFoundSetFilterParam(‘dataprovider’, ‘NOT IN’, array)
foundset.loadAllRecords()
Just remember to duplicate your foundset first if you don't want it to get touched by your search.
Hi.
We solved the problem with a query. We don’t think that “add filters” will be a good idea for us in this case, but thanks.
Roberto Blasco:
Hi pentmasi
Maybe it isn’t the best way to do it, but have you tried with foundset.invertRecords()?
relProgGruposFs.find()
relProgGruposFs.group_id = gruposIdExistentes.join(“||”)
relProgGruposFs.search()
relProgGruposFs.invertRecords();
**Best regards. Roberto Blasco.**
Anyway this line can work correctly when we want, thanks too, we’ll prove faster as can.
Thanks for the answers and have a nice day!
Hi.
I used the function “foundset.invertRecords()” and doesn’t work, this is my code
var formulasFs = forms.formulasLin_tab_tbl.foundset
for (var i = 1, formulasFsSize = formulasFs.getSize(), productosIdsArray = []; i <= formulasFsSize; i++) {
productosIdsArray.push(formulasFs.getRecord(i).producto_id)
}
var IdsProductosOut = productosIdsArray.join("||")
foundset.find()
foundset.producto_id = IdsProductosOut
foundset.search()
foundset.invertRecords()
I have something wrong?
Thanks in advance!!!
try this:
var _fs = databaseManager.convertToDataSet(forms.formulasLin_tab_tbl.foundset,['producto_id']);
/** @type {QBSelect<db:/<tu_base_de_datos/tu_nombre_tabla>} */
var _q = databaseManager.createSelect('db:/tu_base_de_datos/tu_nombre_tabla');
_q.where.add(_q.columns.producto_id.not.isin(_fs.getColumnAsArray(1)));
_q.result.addPk();
foundset.loadRecords(_q);