...
Warning |
---|
When using this form of the function:
i.e., the one with the "fields" parameter, you get back "full objects" which are transferred through type conversion. If you do not use the "fields" parameter, you get only raw data for attributeXX fields, which is always a string. That means you will get a hashmap where all values are strings – if you have numbers in the table, you will get back a string! |
...
Code Block | ||||
---|---|---|---|---|
| ||||
productExtension(String extensionName, Filter ... filters) // searches product extensions customerExtension(String extensionName, Filter ... filters) // searches customer extensions findLookupTable(String tableName) // searches price parameter tables findLookupTableValues(String tableName, Filter ... filters) // searches price parameter tables' values productCompetition(Filter ... filters) // searches competition data productXRef(Filter ... filters) // searches product references findManualPricelists(Date targetDate, String listName) // searches manual pricelistsprice lists findPriceGrids(Date targetDate, String priceGridName) // searches live price grids findPricelists(Date targetDate, String listName) // searches price pricelistslists count(String typeCode, Filter ... filters) // retrieves number of records in an entity |
...
The first parameter of the method api.find() is always a Type Code. This short code identifies the entity to search. The most common type codes you will encounter are the following ones:
Type Code | Description |
---|---|
P | Product Master |
PX | Product Extension (see Searching in Product Extensions below) |
C | Customer Master |
CX | Customer Extension |
PL |
Price List |
PLI |
Price List Item | |
MPL | Manual |
Price List | |
MPLI | Manual |
Price List Item | |
PG | Live Price Grid |
PGI | Live Price Grid Item |
CA | Customer Assignments |
Q | Quote |
For the full list of type codes, see Type Codes.
For searching in Price Parameters, you should almost exclusively use specialized methods api.findLookupTable
and api.findLookupTableValues
. For more details see Searching see Searching in Price Parameters below.
Using Attribute Names in Searches
...
- The number of rows the method api.find can return is limited by a server parameter. It is configurable per partition and by default it is set to 200. You can retrieve the max rows by calling api.getMaxFindResultsLimit. Read how Read how to overcome this limitation belowlimitation below.
A warning is displayed if the number of returned rows returned equals 200 or formulaEngine.script.findMaxResults and the maxRows parameter of the find was not specified (=0). - When filtering the attributed fields (attribute1, ..., attribute30), you need to pass strings to filters because all attributed fields are stored in the database as strings. This is mainly an issue with Dates. Find out how out how to convert them properly below.
- Because of the previous point, you cannot use sorting on numbers (integers, real) because api.find returns and sorts the data as strings. When sorting ($100, $70, $25) ascending, the result will be ($100, $25, $70).Using
api.find
/api.stream
it is not possible to retrieve thetypedId
field. These methods produce a DB query and in the DB we store an "id" field. So, to gettypedId
you would have to manually concatenate the "id" and "type" fields with a dot in a postprocessing logic.
Sorting
If you need to sort the data by a specific column, use the method overload which allows you to specify the sortBy parameter. You can sort by several attributes, separated by commas.
...
Code Block | ||||
---|---|---|---|---|
| ||||
api.find("PX", Filter.equal("name", "GLOBAL.ListPrices"), Filter.greaterOrEqual("attribute1", api.targetDate().format("yyyy-MM-dd"))) |
Searching in Price/Company Parameters
Again, there are two ways to search in Price/Company Parameters (PP). If you do not need advanced features, you should always use the method api.findLookupTableValues().
...
Sometimes, however, you need to use an advanced featuresfeature. In such cases, you need to specify the ID of the lookup table as a filter.
...
The type code differs per price/company parameter type. The following table summarizes when to use which code.
...
If you use a date in your filter, there is one thing you need to be aware of when filtering attributed fields with Date or Timestamp type (i.e., attribute1, attribute2, ... attribute30). Since the values in attributed fields are stored as strings in the database, you need to convert your Date object into a proper String representation. The comparison in the database is then lexicographical but because it follows formatting standards it works well.
...