Skip to main content
Answer

Data models link to archives pdf

  • June 13, 2024
  • 2 replies
  • 35 views

Pablo Palacios
Seasoned
Forum|alt.badge.img+3

hello:
I want to associate files uploaded to CDF type pdf for example to my model, following this scheme:

type Documentation {
name: String
# This is a CDF built in type
file: File
# this is the INVERSE relationship of the Pump.documentation
# Pump.documentation <-> Documentation.relatedPumps
relatedPumps: [Pump] @relation(
direction: INWARDS,
type: { externalId: "Pump.documentation", space: "Space_PabloPalacios" }
)
}

but when I select the uploaded file it only shows me jpg, any ideas?

Best answer by Arild Eide

Hi Pablo

The file reference is the externalId of a file in CDF, regardless of type. Can you verify that the file you are trying to associate indeed has externalId set?

 

If that is the case and you still have problem, might use the Python SDK to create an instance of Document that points to the file like this:

client.data_modeling.instances.apply(NodeApply(space="Space_PabloPalacios", external_id="doc001", sources=[NodeOrEdgeData(ViewId(space="Space_PabloPalacios", external_id="Documentation", version=VIEW_VERSION ), properties={"file": "File001"})])

 

Hope this helps.

 

Arild Eide

 

2 replies

Arild  Eide
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • Answer
  • June 24, 2024

Hi Pablo

The file reference is the externalId of a file in CDF, regardless of type. Can you verify that the file you are trying to associate indeed has externalId set?

 

If that is the case and you still have problem, might use the Python SDK to create an instance of Document that points to the file like this:

client.data_modeling.instances.apply(NodeApply(space="Space_PabloPalacios", external_id="doc001", sources=[NodeOrEdgeData(ViewId(space="Space_PabloPalacios", external_id="Documentation", version=VIEW_VERSION ), properties={"file": "File001"})])

 

Hope this helps.

 

Arild Eide

 


Pablo Palacios
Seasoned
Forum|alt.badge.img+3

Yes, I was indeed missing the externalID in the file, thank you.