05-07-2014 12:00 PM
Hi,
Is is possible to model a object hierarchy for content?
For example, say I am modelling a News Article and all News Articles have an author and we'd like to store the author's first name, surname and their base location. The same author may write many of these articles. Is there a way to select an author which has already been created instead of creating the same author details more than once?
Can I set up a widget on my creation\edit screens for News Articles to browse existing people records for selection?
Thanks, Lynn
05-13-2014 07:27 PM
If I understand correctly:
In both case, here is something that can achieve this. It should a blog actually because it's a long, long answer, but it will be faster to write an answer here ;-).
Author
document type. with author:first_name, etc.NewsArticle
(or in an inherited schema), add the author_ref
field, which will hold the id of the related Author
document. If you plan to query the NewsArticle
on the author name, first name or location, then you must also add the corresponding fields (maybe newsarticle:author_first_name
, newsarticle:author_last_name
and newsarticle:uthor_base_location
NewsArticle
creation layout, add a "Single Document Suggestion" widget and let all the properties with their default values except:
SELECT * FROM Author WHERE author:last_name LIKE ?
So, at this step, you can test with:
Now, if you want to query NewsArticle
on author's first name or last name or both, you have to duplicate the values:
NewsArticle
as "Current document has one of the type"Here is this chain:
1. Fetch > Context Document(s)
2. Push & Pop > Push Document
3. Fetch > Document
value: @{Document["newsarticle:author_ref"])
4. Execution Context > Set Context Variable
name: firstName
value: @{Document["author:first_name"]}
5. Execution Context > Set Context Variable
name: lastName
value: @{Document["author:lasst_name"]}
6. Execution Context > Set Context Variable
name: baseLoc
value: @{Document["author:base_location"]}
7. Push & Pop > Pop Document
8. Document > Update properties
properties: newsarticle:author_first_name=@{firstName}
newsarticle:author_last_name=@{lastName}
newsarticle:author_base_location=@{baseLoc}
save: UNCHECKED
Some explanations on the lines:
Author
Author
uses the id stored by the user when selecting an author via the suggestion widgetAuthor
in context variables, that will be used when saving these value in the NewsArticle
NewsArticle
the current context documentNow, you can also query on articles based on the author. Either via it's ref. or, if you build a custom "Faceted search" for example, by using the fields (news article:author_last_name
etc.), or via NXQL (SELECT * FROM Document WHERE dcm:primaryType = "NewsArticle" AND news article:author_last_name = "TheAuthorLastName"
), or. etc.
05-13-2014 07:27 PM
If I understand correctly:
In both case, here is something that can achieve this. It should a blog actually because it's a long, long answer, but it will be faster to write an answer here ;-).
Author
document type. with author:first_name, etc.NewsArticle
(or in an inherited schema), add the author_ref
field, which will hold the id of the related Author
document. If you plan to query the NewsArticle
on the author name, first name or location, then you must also add the corresponding fields (maybe newsarticle:author_first_name
, newsarticle:author_last_name
and newsarticle:uthor_base_location
NewsArticle
creation layout, add a "Single Document Suggestion" widget and let all the properties with their default values except:
SELECT * FROM Author WHERE author:last_name LIKE ?
So, at this step, you can test with:
Now, if you want to query NewsArticle
on author's first name or last name or both, you have to duplicate the values:
NewsArticle
as "Current document has one of the type"Here is this chain:
1. Fetch > Context Document(s)
2. Push & Pop > Push Document
3. Fetch > Document
value: @{Document["newsarticle:author_ref"])
4. Execution Context > Set Context Variable
name: firstName
value: @{Document["author:first_name"]}
5. Execution Context > Set Context Variable
name: lastName
value: @{Document["author:lasst_name"]}
6. Execution Context > Set Context Variable
name: baseLoc
value: @{Document["author:base_location"]}
7. Push & Pop > Pop Document
8. Document > Update properties
properties: newsarticle:author_first_name=@{firstName}
newsarticle:author_last_name=@{lastName}
newsarticle:author_base_location=@{baseLoc}
save: UNCHECKED
Some explanations on the lines:
Author
Author
uses the id stored by the user when selecting an author via the suggestion widgetAuthor
in context variables, that will be used when saving these value in the NewsArticle
NewsArticle
the current context documentNow, you can also query on articles based on the author. Either via it's ref. or, if you build a custom "Faceted search" for example, by using the fields (news article:author_last_name
etc.), or via NXQL (SELECT * FROM Document WHERE dcm:primaryType = "NewsArticle" AND news article:author_last_name = "TheAuthorLastName"
), or. etc.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.