Hi
I need to combine 2 values from the parent node of a node in a transformation.
I've tried writing a custom transformation which I can't get to work. Is that the only way I can retrieve those values?
I keep getting the following error from my custom function:
error CS1502: The best overloaded method match for 'MyWFunctions.getPackageBuilder(int)' has some invalid arguments
Here are my 2 functions:
/// <summary>
/// Returns the closest ancestor node with the specified classname
/// </summary>
/// <remarks>
/// Will start by checking the node of the node id supplied
/// </remarks>
public static CMS.TreeEngine.TreeNode getClosestAncestorOfClass(int nodeID, string className){
CMS.TreeEngine.TreeNode nCurNode = TreeHelper.SelectSingleNode(nodeID);
if (nCurNode != null)
{
// begin looping up the tree (safeguard stop at the root)
while (nCurNode.NodeClassName != "CMS.Root"){
if (nCurNode.NodeClassName != className){
nCurNode = TreeHelper.SelectSingleNode(nCurNode.NodeParentID);
} else {
return nCurNode;
}
}
}
// fall back on returning a null/empty node
return TreeHelper.SelectSingleNode(0);
}
/// <summary>
/// Returns the builder logo and name from parent node of package
/// </summary>
/// <param name="packageNodeID"></param>
/// <returns>Some HTML with the logo and Name of builder to fi in Transformation
/// </returns>
public static string getPackageBuilder(int packageNodeID){
string result = "";
string bName = "";
string bLogo = "";
CMS.TreeEngine.TreeNode packageNode = TreeHelper.SelectSingleNode(packageNodeID);
if (packageNode != null && packageNode.IsPublished)
{
// get the Builder node
CMS.TreeEngine.TreeNode builderNode = MyWFunctions.getClosestAncestorOfClass(packageNodeID, "Warralily.HLBuilder");
if (builderNode != null && builderNode.NodeClassName == "Warralily.HLBuilder")
{
bName = builderNode.DocumentName;
//bLogo = builderNode.BuilderLogo;
bLogo = "/img/v4/1px.gif";
}
else
{
bName = "Builder";
bLogo = "/img/v4/1px.gif";
}
result = "<img src=\"" + bLogo + "\" width=\"130\" height=\"45\" alt=\"" + bName + "\" /></div><div class=\"builder\"><b>" + bName + "</b>";
}
return result;
}
I think I am on the right track, I just can't get it to work.
Any help would be much appreciated.
James