Trying to get the right sort result

Hi,

I am trying to get some text data joined into one message. The input is this:

'Bericht': collection ['ID'] {
        'ID': text
        'Ordening': number 'position'
}

And I try to join it with this. It’s clear this is not ok, but the error message at the first .‘Ordening’ puzzles me. How should I interpret this?

$'Item'.'Data'.'Bericht' => call 'plural'::'sort' with (
           $'compare' = lambda => $'A'.'Ordening' => greater-than ( $'B'.'Ordening' )
  )  => join ( ) || throw "Bericht niet goed!"

Error message:

no valid 'node' found for 'step' option 'node fetch'. Unexpected 'valid type':
    - expected:  'node'
    - but found: 'entity'
        defined by /'Items'/'Data'/'Bericht' of type 'interface'!'node'::'attributes'::'type'?'property'

$'Item'.'Data'.'Bericht' appears to be a collection in the interface.
For the connector these have the type of plural entity node.
The function 'plural'::'sort' sorts a plural value, which means that each entry assigned to $'A' en $'B' are of the type entity node.
The .'<property>' fetches a property of a node, but since $'A' is an entity node this is not allowed.
You can only use .key and .value on an entity.

To fix this particular error, you simply have to add .value to fetch the value (the node in this case) from the entity.

Ok, so now the sort works, thanks, but the join is not able to work with what it is getting. It should get a list of texts, but it gets a list of entities. Shoud I do a walk and return a test per entry to fix that?

The ( ) can contain a promise chain that is evaluated for each element.
For example:

 => join ( .value .'ID' )
1 Like