Issue
my code
@Function()
@Edits(XYZ)
public async fctLargestNumber(): Promise<XYZ[]> {
const maxObject = Objects.search()
.xYZ()
// .groupBy(e => e.lngPlanningNumber.topValues())
// .segmentBy(e => e.lngPlanningNumber.topValues())
// .filter(data_column => data_column.lngPlanningNumber.byIRanges({ min: 100000, max: 999999 }))
.orderBy(data_column => data_column.lngPlanningNumber.desc())
.takeAsync(1)
//.valueOf();
return maxObject;
now i recieve an output like this:
[
{"typeId":"my-collection","primaryKey":{"id_pk":"ee1b1ac1-008b-479b-a748-01e8702927c9"}}
]
The question is now, how can i receive my result.
- How i can pick out the primary key value?
- How i can search for the requested result (integer) of column "lngPlanningNumber" which belongs to this id? The Promise makes me curious. Thank you
Solution
Partially Solved:
@Function()
@Edits(XYZ)
public fctGetLargestNumber(): Integer {
let DataResult = Objects
.search()
.xYZ()
.orderBy(data_column => data_column.lngPlanningNumber.desc())
.take(1)[0];
const result = DataResult.lngPlanningNumber ?? 0
return result;
}
Attention !!!!! Changes to objects and links are propagated to the Objects.search() APIs after your function has finished executing. This means that Objects.search() APIs will use the old objects, properties and links. As a result, search, filtering, search arounds, and aggregations may not reflect the edits to the Ontology, including creation and deletion. Your function will need to handle this case manually.
--> so i have to create new question to this.....
Answered By - Marco
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.