gpt4 book ai didi

odata - 在 OData 中,有没有办法按数组中的第一个元素排序?

转载 作者:行者123 更新时间:2023-12-03 14:50:14 25 4
gpt4 key购买 nike

我有一个 OData 4 端点,用于在表中显示数据。其中一列有一组从我的元素内的字符串数组连接起来的数据。有没有办法按数组中的第一个元素排序?

我的元素可能如下所示:
[
{
"FirstName": "John",
"MiddleNames": [
"Harry",
"Bobby",
"Sue"
],
"LastName": "Jones"
},
... more elements
]

我想按 MiddleNames[0] 订购。

谢谢您的帮助! $orderby 上的文档充其量是稀疏的......

最佳答案

这是不是 在 OData v4 中支持,该规范不提供针对路径表达式的集合或数组中的特定项的语法,而 $orderby 是路径表达式。然而,它对支持的条件非常明确,因此省略此限制是设计使然。

5.1.1.15 Path Expressions
Properties and navigation properties of the entity type of the set of resources that are addressed by the request URL can be used as operands or function parameters, as shown in the preceding examples.

Properties of complex properties can be used via the same syntax as in resource paths, i.e. by specifying the name of a complex property, followed by a forward slash (/) and the name of a property of the complex property, and so on,

Properties and navigation properties of entities related with a target cardinality 0..1 or 1 can be used by specifying the navigation property, followed by a forward slash (/) and the name of a property of the related entity, and so on.

If a complex property is null, or no entity is related (in case of target cardinality 0..1), its value, and the values of its components, are treated as null.

关于odata - 在 OData 中,有没有办法按数组中的第一个元素排序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43548165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com