How to get the reference of the entities where the field is used

#1

Is there a way to find the references in the C3 platform, which entities has the same field name, instead of searching the fieldname in the IDE?

0 Likes

#2

Can you restate the question?

Are you asking: “Is there a way to find all the types which have a fieldname X?”

If so, you can but it’d be really slow :slight_smile: . Something like (this is pseudo-code)

var typesThatMatch=[];
MetadataStore.tag().types().each(function(t) {
  t.fieldTypes().each(function(ft) {
    if(ft.name() == 'THE_NAME') {
      typesThatMatch.push(t.typename());
    }
  })
})

You could also explore the MetadataGraph types and apis.

0 Likes

#3

That’s My question @rileysiebel - Is there a way to find all the types which have a fieldname X. In Eclipse we have CTRL+Shift+G to find the references where this field is used, just wanted to check if c3 platform does that. Not sure if C3 eclipse plugin has it.:slight_smile: Thanks for the reply.

0 Likes

#4

You can also use the fieldType(fieldName) function to find if a field exists on a type.

var typesThatMatch=[];
MetadataStore.tag().types().each(function(t) {
 if (t.fieldType("THE_NAME")) {
     typesThatMatch.push(t.typename());
 }
})

It will still be very slow.

0 Likes