Brenden, not really, here is how I would do it ... You have custom macro (You can cache it if you want to)
{% GetSliderData("custom.UniversalSlider",CurrentDocument.NodeID).ApplyTransformation("custom.UniversalSlider.Slide") |(identity)GlobalAdministrator%}
Yes it is more code but you get more control.
[MacroMethod(typeof(object), "GetSliderData", 2)]
[MacroMethodParam(0, "ClassName", typeof(string), "ClassName")]
[MacroMethodParam(1, "NodeId", typeof(int), "Node Parent Id")]
public static object GetSliderData(EvaluationContext context, params object[] parameters)
{
return GetSliderDataInternal(ValidationHelper.GetString(parameters[0], ""), ValidationHelper.GetInteger(parameters[1], ""));
}
private static IEnumerable<DataRow> GetSliderDataInternal(string className, int nodeId)
{
InfoDataSet<TreeNode> result = null;
var lang = DocumentContext.CurrentDocumentCulture.CultureCode;
string cacheKey = className + "|All";
using (
CachedSection<InfoDataSet<TreeNode>> css = new CachedSection<InfoDataSet<TreeNode>>(ref result,
CacheProvider.cacheInterval(), true, null, cacheKey))
{
if (css.LoadData)
{
// 1. You can put Where here or down below.
result = DocumentHelper.GetDocuments(className).WhereEquals("NodeParentID", nodeId).TypedResult;
if (css.Cached)
{
css.CacheDependency =
CacheHelper.GetCacheDependency(new[]
{
cacheKey
});
}
css.Data = result;
}
}
return result != null && result.Items.Count > 0
? result.Tables[0].AsEnumerable()
// 2. Or you can put WHERE condtion here Where(x => x.Field<int>("NodeParentID") == nodeId)
: new DataTable().AsEnumerable();
}
I didn't compile this. It might be a mistake in there:)