This recipe shows the use of random datasource.
Steps taken:
- Create a Random Datasource (Dates.ds). Add the following column into the “Define Random Datasource” page:Column Name=Dates, Data Type=String, Value Type=Script,
Value=importScript("/Elixir/ER_Cookbook/lib/basiccalendar.js")
buildCal2("${Month}", “${Year}”, “main”, “month”, “daysofweek”, “days”, 0); - Create a Random Datasource (Months.ds). Add the following column into the “Define Random Datasource” page:Column Name=Month, Data Type=Integer, Value Type=Expression, Auto-increment Start=1 Step=1.
- Create a composite datasource (Calendar.ds). Drag Dates.ds into it as the beginning of the flow. Add a Processor following Dates.ds. In the Processor Wizard, select “General > JavaScript”. In the next page, enter the following into the “processRecord” tab page:importScript("/Elixir/ER_Cookbook/lib/Tokenizer.js")
var tokens = Dates.tokenize(",", “”, true);var out = this.newRecordInstance();
var outData = out.getData();for (var i=1;i<=42;i++)
{
outData[0] = tokens[i];
next.processRecord(out);
}
To download the necessary files for this recipe, refer to the attached ZIP package.
Calendar.zip