Scripting hint: Retrieving a workbook with a part droplist and hierarchy set and initializing some workbook variables

Kinaxis's picture
Printer-friendly versionPrinter-friendly versionPDF versionPDF version

created by on Jul 4, 2014 11:04 AM, last modified by on Jul 4, 2014 11:04 AM

The following is a single JavaScript statement that will instantiate a workbook object (myWorkbook) opening it on a specific scenario, filter and site group and also selecting a single entry on a part droplist (by display value), setting four different workbook variables (of four different types) and selecting a specific node on a specific hierarchy.

Note that every time you see square brackets [] in the statement below, they will enclose a comma-delimited JavaScript array of values.

 

// Example: Retrieving a workbook with a part droplist and hierarchy set.

var myWorkbook = rapidResponse.workbooks.get({ name:"My Workbook", scope:"Public" },

{

    scenarios: [{ name:"myScenario", scope:"Private" }],

    filter: {name: "Buy Parts", scope:"Public"},

    siteGroup: {name: "HQ", scope: "Public"},

    part: "= All =",

    variables: [

        {name: "showLate", value: true},

        {name: "onDate", value: rapidResponse.dateTime.TODAY},

        {name: "worksheetFilterExpression", value: "Order.Site.Value = 'HQ'" },

        {name: "maxQuantity", value: 4000}

    ],

    hierarchies: [{

        hierarchy: {name:"Customer", scope:"Public"},

        path: [{

            name:"C",

            childPath: [

                {name:"Computer Mart"}

            ]

        }]

    }]

});

News Source : Scripting hint: Retrieving a workbook with a part droplist and hierarchy set and initializing some workbook variables
Copy this html code to your website/blog to embed this press release.