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

Printing form Array ( [#action] => /scripting-hint-retrieving-workbook-part-droplist-and-hierarchy-set-and-initializing-some-workbook-va?destination=node%2F765715 [#id] => user-login-form [#validate] => Array ( [0] => user_login_name_validate [1] => user_login_authenticate_validate [2] => user_login_final_validate ) [#submit] => Array ( [0] => user_login_submit ) [name] => Array ( [#type] => textfield [#title] => Username [#maxlength] => 60 [#size] => 15 [#required] => 1 ) [pass] => Array ( [#type] => password [#title] => Password [#maxlength] => 60 [#size] => 15 [#required] => 1 ) [submit] => Array ( [#type] => submit [#value] => Log in ) [links] => Array ( [#value] => ) [#parameters] => Array ( [0] => user_login_block [1] => Array ( [storage] => [submitted] => [post] => Array ( ) ) ) [#build_id] => form-biI53AlQuwIZVrfdaY44CMAcW_lmeL_3chCXwR-yXL0 [#type] => form [#programmed] => [form_build_id] => Array ( [#type] => hidden [#value] => form-biI53AlQuwIZVrfdaY44CMAcW_lmeL_3chCXwR-yXL0 [#id] => form-biI53AlQuwIZVrfdaY44CMAcW_lmeL_3chCXwR-yXL0 [#name] => form_build_id ) [form_id] => Array ( [#type] => hidden [#value] => user_login_block [#id] => edit-user-login-block ) [#description] => [#attributes] => Array ( ) [#required] => [#tree] => [#parents] => Array ( ) [#method] => post [#after_build] => Array ( [0] => ckeditor_process_form [1] => ctools_ajax_form_after_build ) )
Kinaxis's picture
Printer-friendly versionPrinter-friendly 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"}

            ]

        }]

    }]

});

Copy this html code to your website/blog to embed this press release.