yuuvis® RAD Q&A

0 votes
by (750 points)

Hello, I have the following situation:

I want to show all of the documents of the object angebotakte in the reference tree of the auftragsakte but I don't really know how to accomplish this.

Right now my reference Tree has the following json definition and looks like this:

[
	{
		"title": "Angebot",
		"title_locales": {
			"en": "Offer",
			"de": "Angebot"
		},
		"key": "ReferenceType#angebotakte",
	    "folder": [
			 {
			  "key":"Test",
			  "title":"All objects",
			  "field":"type",
			  "showempty":true
			 }
		]
	}
]

My goal is that it looks like this:

So that i can see all the objects that are in the context folder angebotakte right in the reference tree of the auftragsakte.
I hope it's understandable if not feel free to ask.
thanks in advance to everyone who helps! :)

4 Answers

+1 vote
by (520 points)
selected by
 
Best answer

@Marcel Maier
I've tried it out myself now.
With the definition of the reference field as a string with field reference, it doesn't work for me either.
But if you define the reference field as an ID, the reference tree I defined works.

+1 vote
by (520 points)

The reference tree of an object can only contain objects that point to the object.
If every document in the angebotakte folder has a reference field that points to the auftragsakte folder, the documents can be shown in the reference tree of auftragsakte folder.
Because then the reference type is no longer of type angebotakte the key in the json definition must be changed to the reference type of the document type.
With these adjustments, it should work.

by (750 points)
Okay so there's no possibility to show the child objects there without adding a reference field to each child object?
by (520 points)
+1
I do not think so.
But you could define the reference field at the folder and then have this synchronized with read-only reference fields on the documents.
Then you just have to specify the reference at the folder and the documents have the reference too.
by (750 points)
I also thought about something like that but the documents in the angebotakte are there before there is an auftragsakte so I would still need some kind of transfer to add the reference to already existing documents.
0 votes
by (750 points)

@schleich I've got the following structure tree right now for the auftragsakte:

[
	{
		"title": "Angebot",
		"title_locales": {
			"en": "Offer",
			"de": "Angebot"
		},
		"key": "ReferenceType#angebotdoc",
		"type": "angebotdoc",
	    "folder": [
			 {
			  "key": "Referencefield#angebotdoc.auftragsnummer",
			  "title":"Angebot"
			 }
		]
	}
]

I've got the object angebotdoc with the field auftragsnummer that references to the field auftragsnummer in auftragsakte.
But it doesn't show any document:
(the angebotdoc object is even in the references tab of the auftragsakte)

It would also be nice if there where more examples in the documentation for developers cause there's not much explanation for the reference tree right now.

by (520 points)
You do not need to set the reference field as a key.
The angebotdoc just needs to point somewhere to the auftrag folder.

Because you wanted to sort it by type, i set the field property to type.

[
  {
    "title": "Angebot",
    "title_locales": {
          "en": "Offer",
      "de": "Angebot"
    },
    "key": "ReferenceType#angebotdoc",
    "type": "angebotdoc",
    "field":"type"
  }
]
by (750 points)
@schleich I tried it with your reference tree definition but it still isn't showing any document :/
by (520 points)
Then I don't know why, because that's how I used it.
0 votes
by (750 points)

@schleich Thanks for your effort, that's weird.
Is there maybe something wrong within my shema?






by (3.3k points)
+1
The reference tree can only resolve references that are ID references. String references are not resolved.
If you create a ID field named e.g. Auftrag on Angebot and let it point to AuftragAkte, the default reference tree (if no special refernce tree definition is given)  shows all Angebote that are done for this AuftragAkte.
If you mark this ID field Auftrag as context field (Als Kontextfeld verwenden) the field value is mirrored to all documents and your custom definition should work as expected.

Hint: If you want to test your custom reference tree definition before deploying it, you can use the 'Refence tree live' tab at http://DOMAIN/structure/reference.html

br and hope this helps
...