Hello everybody,
recently friend of mine gave me wonderful question:
In PXSelect command, I saw Search, Search2, Search3… keywords, please explain the difference.
Thats really good question which shows his attentiveness to details.
So, no let's go part by part.
Targets
First of all, Search statement can be applied to those kinds of attributes: PXSelector, PXDbScalar and PXDefault.
Also you can apply Search statement to cases when you updated something in cache of Acumatica and what to reopen that part. It can look like this:
Document.Search<POOrder.orderNbr>(currentPoOrder.OrderNbr, currentPoOrder.OrderType);
or like this:
[PXDefault(typeof (Search<Company.baseCuryID>))]
Don't mix attribute use with search in graph. The first form you can use in your methods, while second you can use in DAC class.
As attributes
If to speak about attributes Search allows you to set specific value of of field in your DAC class. In other words it selects exact field rather then a record. The field specification goes as paramter. If to speak about syntax it is identical to PXSelect.
Following search options exist:
Type of search |
Description |
Search<Field> |
Gets field value |
Search<Field, Where> |
Gets field value with filtering by Where condition |
Search<Field, Where, OrderBy> |
Gets field value with filtering by Where condition and ordering |
Search2<Field, Join> |
Gets field value with filtering by using Joins with other tables |
Search2<Field, Join, Where> |
Gets field value with filtering by using Joins with other tables and applying where condition |
Search2<Field, Join, Where, OrderBy> |
Gets field value with filtering by using Joins with other tables and applying where condition and ordering |
Search3<Field, OrderBy> |
Gets field with ordering application |
Search3<Field, Join, OrderBy> |
Gets field value with joins and order by application |
Search4<Field, Aggregate> |
Gets aggregated field value |
Search4<Field, Where, Aggregate> |
Gets aggregated field value with filtering by where condition |
Search4<Field, Where, Aggregate, OrderBy> |
Gets field value with filtering by where, aggregation and order by |
Search5<Field, Join, Aggregate> |
Gets field value fiwth application of joins and aggregateds |
Search5<Field, Join, Where, Aggregate> |
Gets field value with application of joins and where and aggregate |
Search5<Field, Join, Where, Aggregate> |
Gets field value based on join, where and aggregate condition |
Search6<Field, Aggregate, OrderBy> |
Gets field value based Aggregate and order by |
Search6<Field, Join, Aggregate, OrderBy> |
Gets field value based on join, aggregate and order by |
Coalesce<Search1, Search2> |
Gets field value with using Search1 or if Search1 gives null uses Search2 |
I hope with this table you can now better understand which search to use