When you copy a (set of) node(s) you have the option to "'Relate Document On Copy". Afterwards there is no easy way to view the relations or to add relations to other pages. I tried to use the MultiPicker relations datatype for that but it doesn't seem to be able to edit existing relations. So how would I go and edit this document relation? Is there a datatype for that or am I missing something with the ucomponents approach?
Yes I read that blog, used it to create the Language Switcher razor script. Before I write a datatype that does that I want to make sure nobody else did it already.
The MultiPicker Relations datatype is used to wire up multipickers to relation types - so when a multipicker is changed, relations are created / deleted (this can be useful for reverse lookups).
We've been working on updating remote multipickers when using a bidirectional RelationType but that's not ready yet, but I'm guessing this would be similar to what you want as well... the two options seem to be:
1) have the MultiPicker Relations event handler update remote multipickers and set their csv / xml values
2) update multipickers so that they can directly create the relations and use this as their datastore
Btw, the source on CodePlex for the Relations Types package allows relations to be viewed - don't suppose you want to collaborate on this project (or the above) and help update it so that relations can also be created / deleted ?
thanks for the reply Hendy! I haven't looked too much into the multipicker so not sure how that works or how it could help me. Easiest option which you don't seem to mention is to create a new datatype that would handle retrieving and storing of the relation based on the document it is on. What about this pseudo code, would that work?
public partial class RelatedNodes : System.Web.UI.UserControl, IUsercontrolDataEditor
{
[DataEditorSetting("Childnodes", type = typeof(umbraco.editorControls.ultimatepicker.ultimatePickerDataType))]
public List<int> ChildNodes { get; set; }
public void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ChildNodes = (List<int>)value;
}
}
public object value
{
get
{
return SqlHelper.ExecuteReader("SELECT childid FROM umbracoRelation WHERE parentId = @nodeid");
}
set
{
foreach (int node in ChildNodes) {
SqlHelper.ExecuteNonQuery("INSERT INTO umbracoRelation SET (parentid=@nodeid,childid=@childid,reltype=1,datetime=getdate()")
}
}
}
}
How to manage "'Relate Document On Copy" relation
When you copy a (set of) node(s) you have the option to "'Relate Document On Copy". Afterwards there is no easy way to view the relations or to add relations to other pages. I tried to use the MultiPicker relations datatype for that but it doesn't seem to be able to edit existing relations. So how would I go and edit this document relation? Is there a datatype for that or am I missing something with the ucomponents approach?
Did you read this blog? http://blog.hendyracher.co.uk/umbraco-relation-api/ Guess you could create your own datatype that works with the api.
Jeroen
Yes I read that blog, used it to create the Language Switcher razor script. Before I write a datatype that does that I want to make sure nobody else did it already.
Hi Yannick,
The MultiPicker Relations datatype is used to wire up multipickers to relation types - so when a multipicker is changed, relations are created / deleted (this can be useful for reverse lookups).
We've been working on updating remote multipickers when using a bidirectional RelationType but that's not ready yet, but I'm guessing this would be similar to what you want as well... the two options seem to be:
1) have the MultiPicker Relations event handler update remote multipickers and set their csv / xml values
2) update multipickers so that they can directly create the relations and use this as their datastore
Btw, the source on CodePlex for the Relations Types package allows relations to be viewed - don't suppose you want to collaborate on this project (or the above) and help update it so that relations can also be created / deleted ?
Cheers,
Hendy
thanks for the reply Hendy! I haven't looked too much into the multipicker so not sure how that works or how it could help me. Easiest option which you don't seem to mention is to create a new datatype that would handle retrieving and storing of the relation based on the document it is on. What about this pseudo code, would that work?
Hendy, I just had a look at the code of both your projects but they look way to complicated for me to be able to contribute to it unfortunately.
What do you mean exactly with your 1st point? update remote multipickers? What is a remote multipicker?
bump
is working on a reply...