Add `nodeId()` query to datasources
Description
related to
Activity

Scott Theleman December 11, 2023 at 10:35 PMEdited
This is complete and will be in next v9 release. Documentation to be done soon under a separate issue, .

Scott Theleman December 7, 2023 at 1:00 AMEdited
Sorry, I meant nodeFilter
for EntityDS for now, will work on PerfDS later. Right now EntityDS returns node.id
for everything ('label' and ‘value’), will keep that as default for backward compatibility. For PerfDS, I’ll need to use whatever is the current default (as you noted, valueFormat
of fs:fid
and labelFormat
of label
.
Yes you can specify either labelFormat
, valueFormat
or both. For EntityDS, defaults will be node.id
for both.
This could of course be expanded in the future to have more format types, which I assume could be a nice feature.

Mark Mahacek December 7, 2023 at 12:52 AM
That works too. Couple questions:
Would you be able to just specify value or label without the other to use the default? Like just setting valueFormat=id
and the label would follow the defaults?
Given the current default valueFormat
is a combination of two fields, is there a way to specify a value/label that is a combination? (This isn’t a requirement, just curious)

Scott Theleman December 7, 2023 at 12:44 AMEdited
For nodeFilter
, (update: for EntityDS for now) I’m going to add a new capability. You can add labelFormat
and valueFormat
arguments, which can be ['id', ‘label', ‘id:label', 'label:id', 'fs:fid']
labelFormat
is what format you want the labels/text in the dropdown or other display to be. valueFormat
is the format of the value that gets substituted in the query.
So for your case, nodeFilter(labelFormat=label,valueFormat=id)
would display the node labels in the template variable dropdown (and Variables page preview of values), and would use node.id
in the query clause for matching. Note, labelFormat
and valueFormat
are “removed” from the other attributes passed into nodeFilter()
(names were chosen so as not to conflict with any node attribute names), so you can still do things like nodeFilter(labelFormat=label, valueFormat=id, location=Default)
.
If this works, can use this pattern for other queries. Will also open a documentation ticket.

Mark Mahacek December 5, 2023 at 10:27 PM
The PerfDS nodeFilter()
returns a value of FS:FID
and text of nodeLabel
whereas the EntityDS nodeFilter()
just returns a value of the nodeId
, which is not user-friendly for being able to know which item is which in the results.
The request is for a query that will display a nodeLabel
to the user but provide a nodeId
when used in another query.
There are times where the database ID and label of a node are needed to feed into queries for other types of datasources, but there isn’t an existing way to pull that data.
Requesting another query that worked just like
nodeFilter()
but returned a value of the database ID with the node label.