Applying a filter to record.get_related

I am having trouble getting filters to work with record.get_related.
However I express the filter, the whole record set is returned, as if I hadn’t applied a filter.
Can someone please give me the full syntax for record.get_related (including a working example) since it isn’t mentioned in the Help documentation at all and the information available from the ‘Code API documentation’ button is very brief

Morning Angela, may I ask what version of Create you are using?

I am using v10.3.
Have requested an upgrade to v10.4

Hi Angela

The format of the filter I use is is below. In my example I am wanting to return records which are in the subset reference “subsetname”.

[{field_path:’:’+cs.ref(“subsetname”) , ‘value’ : ‘1’ } ]

Does this help you.

1 Like

Hi Angela,

There are many ways in Java Script to filter results and also the create application has the likes of built in as you mentioned.

You could adjust the current function to filter or you could filter the results using a separate function where you would pass in the first lot of results you had,

some useful material to read would be, as this is what i have used to do it, another way would be to create a FOR loop and loop through your array and return any matching results.

If you have a look at lines 103-108 in your code studio event you will see the new code i have just created to do what you need.

if you would like to use Jared’s method then you would need to use it as follows in 10.3 [{field_path:’:’+mats.ref(“subsetname”) , ‘value’ : ‘1’ } ]

When upgraded to 10.4 you can use ‘cs.ref’

Yes, I have already used a filter very similar to Jared’s (using mats.ref). But the system completely ignores it.

Jared, has your example got some quotes missing? I would have thought that there should be one before the text field_path. And possibly another ‘+’ after the cs.ref(‘subsetname’)?

So the final answer was
var _filter = [{
‘field_path’: mats.ref(‘ref_fieldpath_Region’),

The main issue was that I had surrounded my filter definition in quotes (like you would for a filter in
Thank you Mark Grainger!

1 Like