Skip to content
Console(opens in a new tab)

Custom projections

Values the Enigma console computes from several fields, and the query that computes each one.

Selection. These values are selections. Each one comes from other fields, not from a field of its own.

The API stores no field for these values. The Enigma console computes each one with the query below, and you can paste the same fields into your own search. The fields marked @skip(if: true) are helpers: the response leaves them out, and @coalesce reads the first of them that has a value. Each query ran once against production data.

OperatingLocation. The formation year of the legal entity of the operating location. If the operating location has no legal entity, the value comes from a legal entity that does business as its brand.

query {
search(searchInput: {
entityType: OPERATING_LOCATION
name: "Safeway"
conditions: { limit: 1 }
}) {
... on OperatingLocation {
id
formationYear_legalEntities: legalEntities(first: 1) @skip(if: true) {
edges {
node {
registeredEntities(first: 1) {
edges {
node {
formationYear
}
}
}
}
}
}
formationYear_brands: brands(first: 1) @skip(if: true) {
edges {
node {
legalEntities(first: 1) {
edges {
node {
registeredEntities(first: 1) {
edges {
node {
formationYear
}
}
}
}
}
}
}
}
}
formationYear: _fn
@coalesce(
refs: [
"formationYear_legalEntities.edges.0.node.registeredEntities.edges.0.node.formationYear",
"formationYear_brands.edges.0.node.legalEntities.edges.0.node.registeredEntities.edges.0.node.formationYear"
]
)
}
}
}

Response, as returned:

{
"data": {
"search": [
{
"id": "d45a0eb5-7125-4e6d-b21b-52b06d9ec639",
"formationYear": 1986
}
]
}
}

OperatingLocation. The Employer Identification Number (EIN) of the legal entity of the operating location. If the operating location has no legal entity, the value comes from a legal entity that does business as its brand.

query {
search(searchInput: {
entityType: OPERATING_LOCATION
name: "Safeway"
conditions: { limit: 1 }
}) {
... on OperatingLocation {
id
ein_legalEntities: legalEntities(first: 1) @skip(if: true) {
edges {
node {
tins(conditions: { filter: { AND: [{ EQ: ["tinType", "EIN"] }, { EQ: ["rank", 0] }] } }) {
edges {
node {
tin
}
}
}
}
}
}
ein_brands: brands(first: 1) @skip(if: true) {
edges {
node {
legalEntities(first: 1) {
edges {
node {
tins(conditions: { filter: { AND: [{ EQ: ["tinType", "EIN"] }, { EQ: ["rank", 0] }] } }) {
edges {
node {
tin
}
}
}
}
}
}
}
}
}
ein: _fn
@coalesce(
refs: [
"ein_legalEntities.edges.0.node.tins.edges.0.node.tin",
"ein_brands.edges.0.node.legalEntities.edges.0.node.tins.edges.0.node.tin"
]
)
}
}
}

Response, as returned:

{
"data": {
"search": [
{
"id": "d45a0eb5-7125-4e6d-b21b-52b06d9ec639",
"ein": "264563006"
}
]
}
}

OperatingLocation. The registration issue date of the legal entity of the operating location. If the operating location has no legal entity, the value comes from a legal entity that does business as its brand.

query {
search(searchInput: {
entityType: OPERATING_LOCATION
name: "Safeway"
conditions: { limit: 1 }
}) {
... on OperatingLocation {
id
issueDate_legalEntities: legalEntities(first: 1) @skip(if: true) {
edges {
node {
registeredEntities(first: 1) {
edges {
node {
registrations(first: 1) {
edges {
node {
issueDate
}
}
}
}
}
}
}
}
}
issueDate_brands: brands(first: 1) @skip(if: true) {
edges {
node {
legalEntities(first: 1) {
edges {
node {
registeredEntities(first: 1) {
edges {
node {
registrations(first: 1) {
edges {
node {
issueDate
}
}
}
}
}
}
}
}
}
}
}
}
issueDate: _fn
@coalesce(
refs: [
"issueDate_legalEntities.edges.0.node.registeredEntities.edges.0.node.registrations.edges.0.node.issueDate",
"issueDate_brands.edges.0.node.legalEntities.edges.0.node.registeredEntities.edges.0.node.registrations.edges.0.node.issueDate"
]
)
}
}
}

Response, as returned:

{
"data": {
"search": [
{
"id": "d45a0eb5-7125-4e6d-b21b-52b06d9ec639",
"issueDate": "1986-07-23"
}
]
}
}

OperatingLocation. The registration file number of the legal entity of the operating location. If the operating location has no legal entity, the value comes from a legal entity that does business as its brand.

query {
search(searchInput: {
entityType: OPERATING_LOCATION
name: "Safeway"
conditions: { limit: 1 }
}) {
... on OperatingLocation {
id
fileNumber_legalEntities: legalEntities(first: 1) @skip(if: true) {
edges {
node {
registeredEntities(first: 1) {
edges {
node {
registrations(first: 1) {
edges {
node {
fileNumber
}
}
}
}
}
}
}
}
}
fileNumber_brands: brands(first: 1) @skip(if: true) {
edges {
node {
legalEntities(first: 1) {
edges {
node {
registeredEntities(first: 1) {
edges {
node {
registrations(first: 1) {
edges {
node {
fileNumber
}
}
}
}
}
}
}
}
}
}
}
}
fileNumber: _fn
@coalesce(
refs: [
"fileNumber_legalEntities.edges.0.node.registeredEntities.edges.0.node.registrations.edges.0.node.fileNumber",
"fileNumber_brands.edges.0.node.legalEntities.edges.0.node.registeredEntities.edges.0.node.registrations.edges.0.node.fileNumber"
]
)
}
}
}

Response, as returned:

{
"data": {
"search": [
{
"id": "d45a0eb5-7125-4e6d-b21b-52b06d9ec639",
"fileNumber": "2096948"
}
]
}
}

OperatingLocation. The registered entity type of the legal entity of the operating location. If the operating location has no legal entity, the value comes from a legal entity that does business as its brand.

query {
search(searchInput: {
entityType: OPERATING_LOCATION
name: "Safeway"
conditions: { limit: 1 }
}) {
... on OperatingLocation {
id
registeredEntityType_legalEntities: legalEntities(first: 1) @skip(if: true) {
edges {
node {
registeredEntities(first: 1) {
edges {
node {
registeredEntityType
}
}
}
}
}
}
registeredEntityType_brands: brands(first: 1) @skip(if: true) {
edges {
node {
legalEntities(first: 1) {
edges {
node {
registeredEntities(first: 1) {
edges {
node {
registeredEntityType
}
}
}
}
}
}
}
}
}
registeredEntityType: _fn
@coalesce(
refs: [
"registeredEntityType_legalEntities.edges.0.node.registeredEntities.edges.0.node.registeredEntityType",
"registeredEntityType_brands.edges.0.node.legalEntities.edges.0.node.registeredEntities.edges.0.node.registeredEntityType"
]
)
}
}
}

Response, as returned:

{
"data": {
"search": [
{
"id": "d45a0eb5-7125-4e6d-b21b-52b06d9ec639",
"registeredEntityType": "Corporation"
}
]
}
}