Reputation: 11
Can without scripts language get record position in select resutls set?
For example, i have some mySelect
select with results:
[{ ..., value: 1 }, { '@rid': '#9:1', value: 2 }, { ..., value: 3 }]
Any i want to get index of #9:1 some how like that (pseudo code):
select indexOf('#9:1') from (mySelect)
or
select indexOf(select from (mySelect) where @rid='#9:1')
Needed result:
1
Upvotes: 1
Views: 104
Reputation: 371
You can retrieve the position of a substring by querying a string (JSON) resultset as such:
SELECT @this.toJSON().indexOf("#9:1") FROM mySelect WHERE @rid = #9:1
For reference, check out the documentation. I hope this helps.
Upvotes: 1