ScriptFilteredDocumentsLoopScript Property Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

An object that implements the EPTBaseICS_ASDynamicCode interface and contains code to be executed for one or more columns in each processed row.

Namespace: ContentStudio.Site.ActiveScripting.EPT
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax

public EPTBaseICS_ASDynamicCode LoopScript { get; set; }

Property Value

Type: EPTBaseICS_ASDynamicCode
Remarks

The implementation of EPTBaseICS_ASDynamicCode receives in its implementation a reference to a collection of values of all fields returned in result set and these value are stored in a DictionaryTKey, TValue collection passed via the EPTData parameter of the ICS_ASDynamicCode interface. This dictionary will contain keys with the same name as you specified in the XMLFields and are returned. The dynamic code functionality is mainly intended to be used with the component Script filtered documents but if you choose supply your own script for each found row you must supply an implementation of an object that implements the EPTBaseICS_ASDynamicCode interface. Each instance in the array of objects will run code for its own column in the returned data.

To access the Page you must use the Page variable. Ex: Page.Response.Write("");. If the page where the component is included is written in C#, the code must also be C#.
Examples

If you specified Gender and Name in one of the XMLField:s you can write the following code in your implementation:
Visual C#
public class DynaCode : ContentStudio.Site.CodeBase, ContentStudio.Site.ActiveScripting.EPTBase.ICS_ASDynamicCode
{
    void ContentStudio.Site.ActiveScripting.EPTBase.ICS_ASDynamicCode.Invoke(Dictionary<string, string> EPTData)
    {
        if (EPTData["Gender"].ToUpper() == "M")
            Page.Response.Write(Page.Server.HtmlEncode(EPTData["Name"]) + " is a male.";
        else
            Page.Response.Write(Page.Server.HtmlEncode(EPTData["Name"]) + " is a female.";
    }
}
Visual Basic.NET
Public Class DynaCode
    Inherits ContentStudio.Site.CodeBase
    Implements ContentStudio.Site.ActiveScripting.EPTBase.ICS_ASDynamicCode
    Sub Invoke(EPTData As Dictionary(Of String, String))
        Implements ContentStudio.Site.ActiveScripting.EPTBase
        If EPTData("Gender").ToUpper() = "M" Then
            Page.Response.Write(Page.Server.HtmlEncode(EPTData("Name")) & " is a male."
        Else
            Page.Response.Write(Page.Server.HtmlEncode(EPTData("Name")) & " is a female."
        End If
    End Sub
End Class
There is one global key named documentid (usage ex. EPTData["documentid"];) that contains the id of the current document. If you want do a lookup on a category you can use CSF_LookUpField method available in every Content Studio component:
Visual C#
CSF_LookUpField(CategoryId, LookUpFieldName, RetFieldName, LookUpValue, (UseApplicationCache), (ApplicationTimeOut));
Visual Basic.NET
CSF_LookUpField(CategoryId, LookUpFieldName, RetFieldName, LookUpValue, (UseApplicationCache), (ApplicationTimeOut))
See Also

Reference