@@ -412,6 +412,81 @@ wServices['article'].some({
412412
413413This only returns the articleNumber property of all articles.
414414
415+ #### Ordering
416+
417+ With the some function you can order requested data. You can either merely order by fields or by complex expressions.
418+
419+ ``` ts
420+ /**
421+ * Order by articleNumber in ascending order.
422+ *
423+ * ?orderBy=articleNumber
424+ */
425+ wServices [' article' ].some ({
426+ orderBy: [{ FIELD: ' createdDate' , SORT: ' asc' }]
427+ });
428+ ```
429+
430+ ``` ts
431+ /**
432+ * First order by createdDate in ascending order, then by articleNumber in descending order
433+ * If you omit SORT the default ordering will be set to ascending.
434+ *
435+ * ?orderBy=createdDate asc, articleNumber desc
436+ */
437+ wServices [' article' ].some ({
438+ orderBy: [{ FIELD: ' createdDate' }, { FIELD: ' articleNumber' , SORT: ' desc' }]
439+ });
440+ ```
441+
442+ ``` ts
443+ /**
444+ * First order by internalNote in ascending order, if it is not null,
445+ * then by packagingQuantity, if is greater than 400. At last,
446+ * order by articleNumber in ascending order
447+ *
448+ * ?orderBy=(not internalNote null) ? 1 : ((packagingQuantity.price > 400) ? 2 : 3) asc, articleNumber asc
449+ *
450+ */
451+ wServices [' article' ].some ({
452+ orderBy: [
453+ {
454+ CASE: [
455+ ' WHEN' ,
456+ { internalNote: { NULL: false } },
457+ ' THEN' ,
458+ 1 ,
459+ ' ELSE' ,
460+ { CASE: [' WHEN' , { packagingQuantity: { GT: 400 } }, ' THEN' , 2 , ' ELSE' , 3 ] }
461+ ],
462+ SORT: ' asc'
463+ },
464+ { FIELD: ' articleNumber' }
465+ ]
466+ });
467+ ```
468+
469+ There are three modifier functions, ` TRIM ` , ` LOWER ` and ` LENGTH ` , which can be used to adjust the expessions:
470+
471+ ``` ts
472+ /**
473+ * First order by the length of the trimmed lastName in descending order, then by firstName in ascending order
474+ *
475+ * ?orderBy=length(trim(lastName)) desc, firstName asc
476+ */
477+ wServices [' party' ].some ({
478+ orderBy: [
479+ {
480+ FIELD: ' lastName' ,
481+ LENGTH: true ,
482+ TRIM: true ,
483+ SORT: ' desc'
484+ },
485+ { FIELD: ' firstName' }
486+ ]
487+ });
488+ ```
489+
415490### Aborting a request
416491
417492To abort a request an AbortController has to be instantiated and its signal has to be passed to the request. The controller can
0 commit comments