erwin wrote:
I just started trying out LLBLGen, was able to do a few selects updates etc, but I cant seem to crank out a GetMulti for the following SQL Statement
SELECT DISTINCT iss.Signature FROM ImportSoftwareSignature iss
WHERE iss.Signature NOT IN (SELECT ss.Signature FROM SoftwareSignature ss)
ORDER BY iss.Signature
Specifically I did not find out how to declare a FieldCompareSetPredicate where the set contains all rows of another table.
Also I am a bit confused on how to specify DISTINCT and ORDER BY
WHERE iss.Signature NOT IN (SELECT ss.Signature FROM SoftwareSignature ss) can be formulated as:
IPredicate filter = new FieldCompareSetPredicate(
EntityFieldFactory.Create(ImportSoftwareSignatureFieldIndex.Signature),
EntityFieldFactory.Create(SoftwareSignatureFieldIndex.Signature),
SetOperator.In,
null,
true);
OrderBy can be done as:
SortExpression sorter = new SortExpression(SortClauseFactory.Create(ImportSoftwareSignatureFieldIndex.Signature), SortOperator.Ascending);
To get all ImportSoftwareSignature entities:
ImportSoftwareSignatureCollection signatures = new ImportSoftwareSignatureCollection();
signatures.GetMulti(filter, 0, sorter);
To get a list of only the values in the signature field:
ResultsetFields fields = new ResultsetFields(1);
fields.DefineField(ImportSoftwareSignatureFieldIndex.Signature, 0, "Signature");
DataTable dynamicList = new DataTable();
TypedListDAO dao = new TypedListDAO();
dao.GetMultiAsDataTable(fields, dynamicList, 0, sorter, filter, null, false, null, null, 0, 0);
I specify 'false' for the allowDuplicates parameter in GetMultiAsDataTable, which will insert DISTINCT in the query if possible.