How to use the computations function

Follow

With computations you can write your own custom code to build advanced calculations within the d!nk PowerPoint Plugin.

 

data[variable] is used in powerpoint plugin to retrieve values selected in an interactive publication, as well as to set return value to be displayed on the publication. 

Example of integration with Hotzone and Survey response 

var g1= data[profile_start];

var g2 = data[profile_grow];

var g3 = data[profile_retired];

var g4 = data[profile_entrepreneur];

var g5 = data[profile_inheritedwealth];

 

if (g1 != undefined && g1 == 'true' && g4 != undefined && g4 == 'true') {

  data[WhatIsYourRecommendedProduct] = "Atrium Go4it + Entrepreneurs serving Entrepreneurs"; 

}

 

In the example above, data[variable] is used to retrieve the user's selection in the hotzone area with the conditional checks and assignment of return value to a variable set using the Calculate Result function in the plugin (in this case, it will be the variable name called "WhatIsYourRecommendedProduct"). Take note that the hotzone variables are set according to the label name, using the syntax label name_variable name. In the example above, profile is our label name, with the different variable option names such as start and grow. It is recommended that multiple hotzone icons are placed within one image to retrieve the hotzone values easily. 

var surveyResponse1 = data[WhatAreYourDemandsForYourInvestors]; 

var surveyResponse2 = data[HowWouldYouReactWhenYourInvestmentsCouldDropWithOver10];

 if (surveyResponse1 == "1a" && surveyResponse2 == "2a" ){

    data[WhatAreYourDemandsForYourInvestors] = undefined;

    data[HowWouldYouReactWhenYourInvestmentsCouldDropWithOver10] = undefined; 

    gotoPage("#S260");

 

With reference to the survey response example above (where "1a" and "2a" represent survey question options), remember to reset survey response using data[variable] = undefined in the situation where you need to redirect users to another slide in the ppt. This is because Javascript reloads after every user's selection and it might lead to infinite looping between the selected slides. Redirection of slide can be achieved using gotoPage(#slideID) function. The slide number can be found under Computations > View Slide ID. 

Similar to normal javascript debugging, you can use console.log for testing purposes. 

Finally, paste your javascript codes in the Computations function in the powerpoint plugin under "AnyChange Event" and click create. 

 

Continue to an example computation (Qualification form) or code sample

Have more questions? Submit a request

Comments

Powered by Zendesk